I am fairly new to bash(but am proficient in C++), and have only completed a few simple scripts. This is my first script that I actually need to do a serious task.
All of my audiobooks are stored in traditional MP3 format: Music/Artist/Album/*.mp3 (which in this case is Music/Author/Book/Disc/*
I need to move all of the mp3s into their respective Book directories, rename them to Book1.mp3, Book2.mp3, etc , and delete the Disc directories. I have figured out move the contents of a single Disc into it's parent and rename them correctly, and how to delete the directory.
My question is this: How do I parse through the different Disc directories? I am currently running the script from the Disc directory, but would like to run it from the Author directory. I'm thinking that I'm gonna have to use some nested for loops, but can't figure out how to make them work.
Here's is my crude idea:
I think that my problem lies in the first two for loops. I know that those work for files, but I'm not sure about directories.
Thanks in advance for the help!
---------- Post updated at 02:01 PM ---------- Previous update was at 11:55 AM ----------
Nevermind, I figured it out:
Last edited by gamendorf; 05-28-2011 at 02:01 PM..
Hi All,
Can you please provide some pointers to move files from Base path to multiple paths in efficient way.Folder Structure is already created.
/Path/AdminUser/User1/1111/Reports/aaa.txt to /Path/User1/1111/Reports/aaa.txt
/Path/AdminUser/User1/2222/Reports/bbb.txt to... (6 Replies)
how can i move "dataName".sql.gz into a folder called 'database' and then move "$fileName".tar.gz * .htaccess into a folder called 'www' with the entire gzipped file being "$fileName".tar.gz? Is this doable or overly complex.
so
mydemo--2015-03-23-1500.tar.gz
> database
-... (5 Replies)
I am very new to BASH and I am having difficulties moving a long list of image files into similarly named directories. I've been trying to come with a script all night and no luck. Here is what my list of files looks like:
DSC_0059_01.jpg
DSC_0059_02.jpg
DSC_0059_03.jpg
DSC_0059_04.jpg... (5 Replies)
im trying to move media and other files which are in a specified directory to another directory and create another one if it does not exits(where the files will go),them also create a directory will the remaining files with different extensions will go.my first problem is that my script is not... (8 Replies)
hi
i have a list of directory in a text file with all directories name in a column.(this is not exactly a file but i need to do a grep and awk on a file to find that list)
i have the source folders like
abchome/abc/xxyz/nl_xxabc/mm// v01
... (4 Replies)
Hello all,
I'm trying to copy all files within a specified directory to another location based on a find filter of mtime -1 (Solaris OS). The issue that I'm having is that in the destination directory, I want to retain the source directory structure while copying over only the files that have... (4 Replies)
Hi,
I have 500 directories each with multiple data files inside them. The names are sort of random. For example, one directory has files named e_1.dat, e_5.dat, e_8.dat, etc. I need to move the files to a single directory and rename them all in numerical order, from 1.dat to 1000(or some... (1 Reply)
I want to connect to an SFTP server, GET some files, then move those files to a different directory on the SFTP server so I don't try to GET them next time. But there doesn't seem to be a way to move files between directories on the remote server from SFTP. I missing something obvious? And if... (6 Replies)
I have a security system that FTPs the camera files to my machine, however I want to sort the pictures (taken every 30s) into directories by hour.
Every picture uses the following file format.
yymmddhhmmsstt.jpg (where tt is the milliseconds)
I am thinking the for loop is best
for file... (11 Replies)