please help me remove the spaces in filenames in a directory!
Hey everyone
I recently copied a folder over from my Winbl0wz partition. I noticed that many of the files have spaces in their file names. Do you all know of any scripts that i could use to remove all the spaces in the names of files contained in a directory? All help is GREATLY appreciated in advance! |
Not onehundred percent trouble free so YMMV(VM):
Code:
find /home/asilentmurmur/windowsdir -type f | while read f; do mv "${f}" "${f// /_}"; done |
how about
Code:
find /home/asilentmurmur/windowsdir -type f -execdir rename '" "' '""' '{}' \; |
If you have python installed try this:
Code:
#!/usr/bin/python If you want to do it in bash, try this: Code:
for i in *; do mv "$i" "$(echo $i | tr ' ' '_')"; done Code:
for i in * *; { mv ''$i'' $(echo $i | sed 's/ /_/g'); } Code:
#!/bin/bash |
All times are GMT -5. The time now is 07:25 AM. |