While I'm in the process of upgrading my brother's WinXP computer, I've
installed Gramps 3.2.3-1 so that he can compare/use. He currently uses
Rootsmagic, so I exported as a GED and imported into Gramps. All is well
on the Windows machine; all records came across (8758 people, 2145
unique surnames) and the graphics (many) are appearing fine.
I've exported the whole thing (including media) to a .gpkg (654.3MB) so
that I can use on my linux systems. All of the entries came across w/o
issues, but the problem is the media path/graphic naming conventions
that he used. An example:
C:My DocumentsMy Pictures<surname> Geneology<surname>, <firstname>
<middlename_or_initial> Certificate of Birth.jpg
Some are even worse, and longer with added subfolders for individuals,
pound (#) signs, etc., but that's pretty much convention he's used. Made
sense to him so that he could easily look at the files in WinExplorer &
see exactly what the files pertain to. Unfortunately the spaces, commas,
periods, # signs et all are creating issues. My system reads them
properly, i.e.:
<middleinitial>/<sirname>, <firstname> <middleinitial>. Certificate of
Birth.jpg
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
individually?
*I'm not sure about Bash, but this would be fairly easy in Python:
import os
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 (_).
Jon
--
ubuntu-users mailing list
ubuntu-users@lists.ubuntu.com
Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/ubuntu-users
07-08-2010, 06:20 AM
"Tim H."
File path conversions - Windows to Linux +GRAMPS
On 07/07/2010 08:27 PM, NoOp wrote:
> While I'm in the process of upgrading my brother's WinXP computer, I've
> installed Gramps 3.2.3-1 so that he can compare/use. He currently uses
> Rootsmagic, so I exported as a GED and imported into Gramps. All is well
> on the Windows machine; all records came across (8758 people, 2145
> unique surnames) and the graphics (many) are appearing fine.
>
> I've exported the whole thing (including media) to a .gpkg (654.3MB) so
> that I can use on my linux systems. All of the entries came across w/o
> issues, but the problem is the media path/graphic naming conventions
> that he used. An example:
>
> C:My DocumentsMy Pictures<surname> Geneology<surname>,<firstname>
> <middlename_or_initial> Certificate of Birth.jpg
>
> Some are even worse, and longer with added subfolders for individuals,
> pound (#) signs, etc., but that's pretty much convention he's used. Made
> sense to him so that he could easily look at the files in WinExplorer&
> see exactly what the files pertain to. 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
> Birth.jpg
>
> 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
> individually?
>
>
>
I use this script I found on the net sometime ago. Feel free to alter
the definition of NEWLINE to your liking:
if [ -n "$1" ]
then
if [ -d "$1" ]
then
cd "$1"
else
echo invalid directory
exit
fi
fi
for i in *
do
OLDNAME="$i"
NEWNAME=`echo "$i" | tr ' ' '_' | tr A-Z a-z | tr ',' '_' | sed
s/_-_/-/g| sed s/__/_/g`
if [ "$NEWNAME" != "$OLDNAME" ]
then
TMPNAME="$i"_TMP
echo ""
mv -v -- "$OLDNAME" "$NEWNAME"
# mv -v -- "$TMPNAME" "$NEWNAME"
fi
if [ -d "$NEWNAME" ]
then
echo Recursing lowercase for directory "$NEWNAME"
$0 "$NEWNAME"
fi
done
### End Code #########################################
Tim H.
--
ubuntu-users mailing list
ubuntu-users@lists.ubuntu.com
Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/ubuntu-users
07-08-2010, 07:06 AM
Markus Schönhaber
File path conversions - Windows to Linux +GRAMPS
08.07.2010 02:27, NoOp:
> /home/<username>/<somename>_xml.gpkg.media/My Documents/My
> Pictures/<surname> Geneology/<surname>, <firstname>
> <middleinitial>/<sirname>, <firstname> <middleinitial>. Certificate of
> Birth.jpg
>
> 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
> individually?
Take a look at rename(1). The version of rename Ubuntu installs by
default allows you to specify a Perl-style regular expression that will
be applied to the given file names, for example like
rename -n 's/( |,)//' *.jpg
-n tells rename only to show what it would do.
--
Regards
mks
--
ubuntu-users mailing list
ubuntu-users@lists.ubuntu.com
Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/ubuntu-users
07-08-2010, 07:48 AM
Colin Law
File path conversions - Windows to Linux +GRAMPS
On 8 July 2010 01:27, NoOp <glgxg@sbcglobal.net> wrote:
> While I'm in the process of upgrading my brother's WinXP computer, I've
> installed Gramps 3.2.3-1 so that he can compare/use. He currently uses
> Rootsmagic, so I exported as a GED and imported into Gramps. All is well
> on the Windows machine; all records came across (8758 people, 2145
> unique surnames) and the graphics (many) are appearing fine.
>
> I've exported the whole thing (including media) to a .gpkg (654.3MB) so
> that I can use on my linux systems. All of the entries came across w/o
> issues, but the problem is the media path/graphic naming conventions
> that he used. An example:
>
> C:My DocumentsMy Pictures<surname> Geneology<surname>, <firstname>
> <middlename_or_initial> Certificate of Birth.jpg
>
> Some are even worse, and longer with added subfolders for individuals,
> pound (#) signs, etc., but that's pretty much convention he's used. Made
> sense to him so that he could easily look at the files in WinExplorer &
> see exactly what the files pertain to. 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
> Birth.jpg
>
> 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
> individually?
Won't you have to modify the link to the file in the GED data as well
as renaming the file? Or perhaps I misunderstand what is going on.
Colin
--
ubuntu-users mailing list
ubuntu-users@lists.ubuntu.com
Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/ubuntu-users
07-08-2010, 07:46 PM
NoOp
File path conversions - Windows to Linux +GRAMPS
On 07/08/2010 12:48 AM, Colin Law wrote:
...
> Won't you have to modify the link to the file in the GED data as well
> as renaming the file? Or perhaps I misunderstand what is going on.
>
> Colin
Yes. But that is pretty easy in Gramps. The idea is to clean up the
entire structure, then export back to a new GED.
Thanks to all the suggestions (Jon, Tim, Markus); I'll give those a try
& report back. Thankfully I've multiple copies on multiple machines, so
if I screw one up in the process I've plenty of backups.
--
ubuntu-users mailing list
ubuntu-users@lists.ubuntu.com
Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/ubuntu-users