Rename Name of Folder And File Containing the Character

edaudin

Registered
I want on console mode, rename all folder on my MAC contain the character BACKSLASH (\)

I'm sure there is a UNIX command that can replacing the "" (backslash) by "_" (underscore) on all folder on my MAC on one shoot.

Can you help me ?

I want the same operation for all file on my MAC

Regards

Eric Daudin
eric.daudin@noos.fr
 
#!/usr/bin/perl

@in = `ls -lt`;

#print @in;
foreach(@in)
{
@online=split(/\s+/,$_);

shift(@online);
shift(@online);
shift(@online);
shift(@online);
shift(@online);
shift(@online);
shift(@online);
shift(@online);

$numb=scalar(@online);
if ($numb>1)
{
$origname=join("\\ ", @online);
$newname=join("_", @online);
`mv $origname $newname`;
}
}


This isn't too pretty, but it will work for files and folders.

It will not work on links, and will instead produce mangled looking filenames.

sb
 
Back
Top