File path conversions - Windows to Linux +GRAMPS
jon.l.cosby at gmail.com
Thu Jul 8 03:49:20 UTC 2010
On Wed, Jul 7, 2010 at 5:27 PM, NoOp <glgxg at sbcglobal.net> wrote:
Unfortunately the spaces, commas,
> periods, # signs et all are creating issues. My system reads them
> properly, i.e.:
> /home/<username>/<somename>_xml.gpkg.media/My Documents/My
> Pictures/<surname> Geneology/<surname>, <firstname>
> <middleinitial>/<sirname>, <firstname> <middleinitial>. Certificate of
> But I'd like to figure out a way to clean all those up to no spaces,
> periods, commas, etc.
> Any suggestions on how I can batch convert all of those to
> path/filenames? Or am I doomed to having to go through each one
I'm not sure about Bash, but this would be fairly easy in Python:
SPACE = " "
COMMA = ","
PATH = "/path/to/files"
for filename in os.listdir(PATH) :
os.rename(filename, filename.replace(SPACE, "_").replace(COMMA, "_"))
This would replace all spaces and commas with underscores (_).
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the ubuntu-users