-
-
Save YourFriendCaspian/cc5df20b67a073111569567134f7b7b8 to your computer and use it in GitHub Desktop.
replace spaces in file names with underscores
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/perl | |
# replace spaces in all filenames with underscores | |
$dir = "."; | |
opendir(DIR, $dir) || die "Can't open $dir\n"; | |
for (readdir(DIR)) { | |
next if $_ eq '.'; | |
next if $_ eq '..'; | |
next if $_ eq 'lost+found'; | |
$newfile = $_; | |
$newfile =~ s/ /_/g; | |
rename $_, $newfile; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment