I have an FTP process that is constantly putting files into a directory. The date created is part of the filename in a format like this:
YYYY-MM-DD-HH-MM-SS-xxxxxxxxxx.wav
I would like to move the files to another directory based on the date the file was created. I can use either the filename or the date stamp, whichever is easier. Only the month and year needs to be considered. I have created directories using the following format:
Jan_2016
Feb_2016
I have been creating directories and moving the files manually but I would like to automate this with a bash script that will create the directory if it does not exist.
What I have been doing so far is manually creating the directories and then running this command:
mv ./2016-02*.wav Feb_2016/
date
andcut
commands and usingif
statement for comparison of directory names and existence. What have you done so far ? Can you show it in the original post by editing it ?2016-01
and2016-02
-- those have the advantage of being listed in chronological order. Once you accumulate a few year's worth of <strike>crap</strike> treasure, you'll be annoyed that all the January months are grouped together, etc