Unix scripting renaming files
I have probably been working on this for 5+ hours (since im learning and trying to do this) but im trying to copy and rename all the files (and sub files) in a directory to include the date in them and move them to a folder. But only files that have the .pl4 extensions... I have it going through files but errors when i rename
Any help is appriciated. This is probably the furthest i have gotten.. Update: A little better.... #! /bin/sh for file in *.pl4; do STR=$file echo $STR CLEANSTR=$( date +%m-%d-%y )"$STR" echo $CLEANSTR cp ${file} pathloss/$CLEANSTR done; |
I threw this together in about 20 min, so I definitely haven't had time to see how it handles large numbers of files:
#! /bin/sh for file in *.pl4; do mv ${file} "<path_to_new_dir>`date +%Y%m%d`${file}" done; I believe that should take care of it. |
Thanks a bunch, one thing though... It doesnt go recursively through sub folders... I may be able to find this but i feel its easy.. Ill look it up and if I find ill delete this but some help would be nice.
Thanks again |
Maybe something like:
Code:
for file in $(find -name '*.pl4') |
awesome thanks a bunch
|
All times are GMT -5. The time now is 09:01 AM. |