Showing posts with label Bash. Show all posts
Showing posts with label Bash. Show all posts

Monday, June 18, 2012

A one liner to rename files sequentially

This one line script will rename image files into nice sequential files such as

IMG_000.JPG
IMG_001.JPG
etc.

EII=0; for each in `ls -rt`; do mv $each IMG.`printf "%03d" $EII`.JPG; EII=`expr $EII + 1`; done;

Wednesday, November 16, 2011

List files in FTP and Download/Unzip it

curl ftp://ftp.aoml.noaa.gov/phod/pub/IES_FTP/abaco/ > temp.txt


for each in `cat temp.txt | awk '{print $9}'`; do wget ftp://ftp.aoml.noaa.gov/phod/pub/IES_FTP/abaco/$each && unzip $each; done;

Tuesday, October 25, 2011

Exporting path...

I always seem to forget this line...

I currently have this in .bashrc, but it may not be the best place to put it.

export PATH=$PATH:/new/path/to/add:/other/new/path

Tuesday, June 21, 2011

Some more great Unix Lines!

for each in `ls | cut -f1 d '-'`; do mv $each /remoteFolder/; done


find E-GEOD-* \( ! -name dir -prune \)

Saturday, November 6, 2010

Delete Empty Folders Recursively

I found a useful command yesterday that I intended on posting but only remembered now.

find . -type d -empty -delete

This little line works wonders when you have a lot of empty folders to delete.