osx - Mass replace characters in filenames from terminal? -
i have 50 files in directory contain spaces, apostrophes, etc. how can go mass-renaming them remove apostrophes , replaces spaces underscores?
i can
ls | grep '*.txt' | xargs .... but i'm not sure in xargs bit
i use ren-regexp, perl script lets mass-rename files easily.
you'd ren-regexp 's/ /_/g' *.txt.
$ ls -l total 16 -rw-r--r-- 1 marc marc 7 apr 11 21:18 that's wrap.txt -rw-r--r-- 1 marc marc 6 apr 11 21:18 what's time.txt $ ren-regexp "s/\'//g" "s/ /_/g" *.txt that's wrap.txt 1 thats wrap.txt 2 thats_a_wrap.txt what's time.txt 1 whats time.txt 2 whats_the_time.txt $ ls -l total 16 -rw-r--r-- 1 marc marc 7 apr 11 21:18 thats_a_wrap.txt -rw-r--r-- 1 marc marc 6 apr 11 21:18 whats_the_time.txt
Comments
Post a Comment