I have files with names like these:
truth-out.org-Billions Against Bayer Here We Come.pdf
nytimes.com-An Email Trail Leads to Gov Walker.pdf
krugman.blogs.nytimes.com-A Lie Too Far.pdf
takingnote.blogs.nytimes.com-Donald Trumps Cynical Play for Womens Votes.pdf
Is there a way to mass rename these files so that everything up to and including the dash character is removed?
TIA.
Robert
Renaming files
Moderators: fgagnon, nikos, Site Mods
Re: Renaming files
not at present
i'm not even sure this could be done with regular expression mass rename
i'm not even sure this could be done with regular expression mass rename
- FrizzleFry
- Platinum Member
- Posts: 1241
- Joined: 2005 Oct 16, 19:09
Re: Renaming files
matching the site name prefixes should not be a problem for a regex renamer...
^.+\.(com|org)-
here is a quick PowerShell script that should do it...
I commented out the actual rename so you can test it first
^.+\.(com|org)-
here is a quick PowerShell script that should do it...
Code: Select all
gci *.pdf | foreach-object {
$_.name
$newname = $_.name -replace '^.+\.(com|org)-'
$newname
''
#rename-item $_.fullname $newname
}
Re: Renaming files
Thanks a lot! This worked beautifully!