It is often a pain to have spaces in file names when working at the command line, so remove them, or at least replace then with underscores. In this case it works on all bed files in the current directory.
ls *.bed |perl -ne 'use File::Copy;chomp;$old=$_;s/\s+/_/g;move($old,$_);'
You could replace the
ls with a
find for more control.
Didn't work for my needs as there were too many files and the ls blew up. Instead I used
ReplyDeletefind . -name "*.xml" | perl -ne 'use File::Copy;chomp;$old=$_;s/\s+/_/g;move($old,$_);'
which worked