I'm just getting into Bash scripting, and would appreciate some help with this question. My music collection is split into a smaller, "active" set, kept on my laptop, and a much larger collection on an external hard drive. I've just converted some of the larger filetypes on my "active" set to *.mp3, and now want to move all the original files (*.flac) to the external hard drive. I need some help putting together a command or script that will recursively search my active music set for *.flac and then move them, but keeping the source directory structure. Some or all of these subdirectories may not exist on the destination.
eg. On the active music set, I may have:
/Music/artist1/album1/(a mix of *.mp3 and *.flac files)
/Music/artist2/album1/(a mix of *.mp3 and *.flac files)
and on the hard drive
/Music 2/artist1/album2/(the contents of the album)
So when copying, it'll need to create "/album1/" in "artist1" on the destination, and also "/artist2/album1/"
Thanks in advance!
I keep my Music on a USB flash drive. I do not have room on my laptop to store my mp3 library so this is not an option. Whenever, I remove the flash drive (or restart my computer, i think) my music player (rhythmbox currently) forgets where the music is stored. I have to go through reimporting my whole music library which is time consuming and tedious. I imagine that my music player can't find the files because the flash drive gets mapped to a different mount point or something after restarting or removing the drive.
TL;DR
How can I setup my laptop so that my music player can find my music library on a usb flash drive without needing to constantly re-import my library?
Also, I have the same question to syncing to cloud storage. How can I automatically sync flash storage to the cloud?
Hi. I've installed Arch Linux on a Wandboard running Logitech Media Server (LMS). LMS needs to read my music files off of a NAS network share. I can't figure out how to mount that network share.
I was told by someone who has a similar NAS to make the following entry in etc/fstab:
//192.168.10.15/media/Music /mnt/netdrive cifs noauto,x-systemd.automount,user=nobody,password="",iocharse t=utf8,noperm,nounix,nobrl 0 0
But when I start LMS and point it to /mnt/netdrive, my media/Music folder isn't shown. Is there a problem with the way I'm trying to mount the network share?
I've tried using "root" and "admin" as username and the admin password of the NAS as password, but still no luck. I've tried mounting the share manually, but I get a "permission denied" error.
Any help would be greatly appreciated.
Hi all,
I am trying to write a script that syncs files from source to destination. I have one centralized server that can ssh to any servers without pw. Now when I run the script, it can ssh to source server perfectly fine, but you need to enter password for destination server. Was wondering how I can clean this up before I start using case statements
Below is a sample I wrote
#!/bin/bash
#This scripts syncs shit
echo "Type in ID: "
read ID
echo "Type in Server : " #source server
read S
echo "Type in Destination Server: "
read DS
if [ $S == 9 ]; then
ssh -t "root@"$S"webserver1" "rsync -av /home/rlui/"$ID "root@"$DS"webserver2:/home/rlui/";
ssh -t "root@"$S"webserver1" "rsync -av /home/rlui/tmp/"$ID "root@sl"$DS"webserver2:/home/rlui/tmp/"
exit 1
where S and DS are cluster numbers
I apologize in advance if I am not clear on anything
Hello all.
I have 100 sub-directories that "rar" files exist in them, How can I move all rar files into parent directory?
I used "find sourcedir -type f -exec mv {} targetdir \; " but i just copy one file and all files deleted
Thank you.
gold finger was kind enough to share this with me a while ago:
Quote:
Do backups to either another HDD, partition, or a USB stick (if big enough to hold your data). Can use program to make an initial backup of /home/gregory; then use it to periodically update that backup by having it sync between your installed Xubuntu /home/gregory and the backup copy. The sync function will just copy over things that are new or changed, rather than copying everything all over again.
Assuming your Xubuntu filesystem is Ext4, example of doing initial backup would be something like this:
* Spare USB with large partition formatted as Ext4 and labeled "BACKUPS"
* Open luckybackup and choose "Backup" function
* "Source" = /home/gregory
* "Destination" = /media/gregory/BACKUPS (might be under /media/BACKUPS)
* Check box to not create new directories (it will just do exact copy of source)
After initial backup, either make a new task for syncing, or modify the backup task to turn it into a syncing task instead. Then use that periodically to update the backed-up /home/gregory.
I've downloaded Luckybackup and have been experimenting with it but I'm still not sure the best way to go about using it as a backup. Like in gold finger's advice, why would I check the box to not create new directories? It seems to me doing it without checking the box re-creates things just the way they are on my computer. When I check the box it just takes everything out of the folders. Seems confusing (and unnecessasry). And I have a really hard time finding the errors after a run and when I do find them I do I don't know what they mean. And so if I backup the source destination it makes an exact copy on my destination drive (with folders if I don't check the box, without if I do). Then if I do that as an ongoing thing, I will be backing up all my data with each run (which I'm assuming would be much more time consuming), whereas if I choose 'syncrhonize source and destination' it will only backup the changes in my source and usb drive (which would be my destination drive)?
Is that the idea?
And I noticed that Lucky did not want to transfer things with colons in them. Googling around somebody said that problem would be taken care of by switching to ext 3 or ext 4 for formatting the destination drive (as gold finger suggested). Is this a good idea? (I've always felt comfortabel with FAT because if I needed to plug my flash drive into Microsoft it would work (as well as with Linux).)
So the first time I use Lucky I choose "backup source inside destination" and of course the source and destination. Should I check the "Do NOT create extra directory" box? (Again, that seems off as 95% of what I'll be backing up is in folders.)
Then after I've done that, I choose the snyc option?
A lot of stuff. I know. Thanks.
PS. As a slight complication I have the data (basically the "home" folder) of my two computers (work and home) synced via Copy.com.
I am new to Bash scripting.
I have a main directory called Photos which has many subdirectories like People, Places and Things. Each of these subdirectories is populated by other subdirectories and lots of JPG photo images.
The digital cameras name the files in a way that is difficult to manage with web hosting.
I would like to go to each directory and subdirectory and rename the photos 1.jpg, 2.jpg, 3.jpg, etc. so that I can use a simple XML template to access them by specifying only a hosting directory.
I tried to use the following script:
#! /bin/bash
cd /home/paul/test
find . -name "*.jpg" -print0 | rename -v 's/.+/our $i; sprintf("%d.jpg", 1+$i++)/e' * -vn
exit 0
It successfully renames all of the files in all of the directories, but it does not restart the numbering for each new subdirectory. So first it goes through Photos and renames the three JPG files there 1.jpg, 2.jpg and 3. jpg, and then it opens the first subdirectory People and names the three JPG files there 4.jpg, 5.jpg and 6.jpg. Next it moves to the next subdirectory and continues sequential renaming until it is done.
I want it to restart sequential renaming with each new subdirectory, so that after renaming the three JPG files in Photos to 1.jpg, 2.jpg and 3.jpg, it moves to the first subdirectory and renames the JPG files there starting with 1.jpg again.
That way I use the links 1.jpg, 2.jpg, 3.jpg, etc in the XML template and just change the directory name to download the photos from the web.
Thanks for any help you can give me.
I am trying to move away from windows. Installed Dragora with lots of hitches I managed to fix until I booted from hard drive. on boot from hard drive I got a blank screen for over an hour. On my next look at the screen the next morning I have these 4 lines over and over.
ssb0:0 Missing Free firmware
"b43-phy0 ERROR:firmware file"/*(DEBLOBBED)*/"request failed (err=-22)
"b43-phy0 ERROR:firmware file"b43-open/ucode15.fw" not found
"b43-phy0 ERROR:/*(DEBLOBBED)*/
there is a curser flashing and I am able to type but unable to start a new line. I typed setup signed in and recieved
" No mail.
root@rafaela:~# " Am I in line edit mode? wha;t went wrong? how do I get the graphical interface? how do I install the missing files? Should I run screaming for the hills?
Hello.
I have checked the other threads and either I have missed my answer or did not understand that it was the answer. I apologise in advance if I am being a repeater:
The Problem: I am running 17 mint. I installed a toshiba external Hard Drive using Gparted- Fast and easy, BUT, somehow I installed the external as root, I cannot move files to the external because I am not root? Under permissions it states that the Owner Cannot Be Determined.
Any help would be great.
Have a great night, morning or afternoon!
I copied the following from my linux console.
grep -lr "SMTP" *.ini
grep: *.ini: No such file or directory
I wanted to search recursively under current location in files with extenstion .ini
Actually there are files that contain "SMTP" under this directory. But I got the above error message.
What is wrong? I am using centos 6.
Thanks,
3rock
Hi. I am a noob to Red Hat but have previously used but am no expert with other linuxes such as Puppy and Ubuntu. Can anyone suggest a good music file player for Red Hat (or in general) ? I have many files that I have recorded from records and cassette tapes but Itunes/ Windows won't let me play them, saying that the ORIGINAL cannot be found, so I am switching back to Linux. Thank you. Admins- if this is in the wrong area feel free to move it. Thanks.