[svlug] copying special files to VFAT
Erik Steffl
steffl at bigfoot.com
Sun Nov 11 01:23:01 PST 2001
Rafael Skodlar wrote:
>
> On Sat, Nov 10, 2001 at 08:48:26AM -0800, Marc MERLIN wrote:
> > Sometimes I have to give files to people who don't have linux, so I copy
> > them on a vfat partition on a harddrive and lend the HD.
>
> That's two step work. I would bet a 6pack that you could do it with Samba.
samba shows tt:tt as Tttt~rb (that's with my settings, maybe you can
change the way it maps win-invalid filenames)
> I don't have the book with me at home to see what needs to be done but
> remember that you can translate CR-LF to LF inside files or vice versa.
> There is a provision for running scripts when the user does something that
> meets criteria.
>
> Just wonder why do you use ':' in filenames that's not an sh convention
? there is no convention how to name your files, one just names them
whichever way seems appropriate (as long as the names are valid names).
generally it's more convenient to not use special characters (the ones
that are interpreted by shells or commonly used tools) but it's not
neccessary and generally only result of tools being too crappy (e.g.
xargs (specially the non-gnu one))
> AFAIK. Bash is smart enough to auto escape it
> mv tt\:tt
> but some shells are not.
why would they? ':' is not a special character, no need to escape:
bash-2.05$ cat >tt:tt
some text
bash-2.05$ cat tt:tt
some text
actually I wonder why would bash escape it (when autocompleting
command).
> > The problem is that some of my filenames have characters that aren't valid
> > on VFAT (like ':').
> >
> > This causes the copy (cp -av) to fail.
> > Of course, I can rename the files beforehand to be compatible with VFAT, but
> > I do not wish to compromize on the names I use because windows is
> > restricted.
> >
> > I could also use UMSDOS, but the files on the other side will then lose
> > their name almost entirely.
> >
> > What I'd really like is some way to have the characters that aren't vfat
> > compatible renamed on the fly to something else as the file gets written.
> >
> > So I have
> > cp 'file:name.foobar' /mnt/vfat
> > the file would be copied as file!name.foobar
> >
> > I can write a perl script to study the filenames and rename them before the
> > copy, but I was hoping for something a bit simpler than that, like a mount
> > option for the vfat partition that discards forbidden characters (I looked
> > in the options, but none seemed to do that).
> >
> > Did I miss something?
well, you can always tar the files and let them figure it out:-) [just
tried it, winzip shows the filename properly but cannot extract it, says
cannot create file tt:tt].
the other quick option is to use tr to map certain characters (not
what you're looking for but I guess the most 'quick&dirty' solution
available). of course, when you rename files, what if the files you want
to rename it to already exists? problem.
what about useing the cd filesystem? I'd expect there would be some
automatic renaming for these...
erik
More information about the svlug
mailing list