[PLUG] Script Help

Michael Barnes barnmichael at gmail.com
Mon Dec 21 02:38:20 UTC 2020


Sad thing about getting old. Memory ain't what it used to be.

About 15 years or so ago, I wrote a script to trim filenames. What I did
with the script  was to download a group of files from an ftp site to a
folder. The files were named something like

ABC 12-12-20 TodayShow.mp3

The "TodayShow" was different for each file. I needed to remove everything
after the date, rename the file and move it to another folder.

The trimming portion of the script was
cd /home/Xfer/downloads
for FILE in *.mp3; do mv "$FILE" "$(echo "$FILE"|tr ' ' '_')"; done
for FILE in *.mp3; do mv "$FILE" ${FILE%%???????.mp3}.mp3; done

I need to update this script for a similar purpose. I just can't remember
exactly how this works. Would someone mind please translating or explaining
this to me so I can modify it?

Thanks,
Michael



More information about the PLUG mailing list