Welcome guest. Before posting on our computer help forum, you must register. Click here it's easy and free.

Author Topic: xcopy/copy refuses to use long file names  (Read 15419 times)

0 Members and 1 Guest are viewing this topic.

Dan_Stephens

  • Guest
xcopy/copy refuses to use long file names
« on: January 22, 2007, 05:50:20 PM »
Good evening:

When I use COPY or XCOPY, I can use the long names for the directories using ""s, but when copying using wild card like:

xcopy C:\"Program Files"\"USAPhotoMaps"\"USAPhotoMapsData"\u%1*.*  F:\USAMaps\USAPhotoMapsData\ /y

It uses the short name, which doesn't match the same criteria.

I see the /N switch that says it will force the use of the short name, but leaving it off doesn't use the long name.  Same results with xcopy and copy.

BTW, I have verified that the %1 parameter really contains what I expect.  Also, doing a DIR /x shows the files like u17nnnnnn.ptr with a short name of U10000~1.PTR, so I'm sure I am not misinterpreting the symptoms.

Makes me a little afeared to try the next step which is a wild card delete of the same files.

Any ideas?

Windows XP

-dan

My programs don't have bugs, they just develop random features.

Dusty



    Egghead

  • I could if she would, but she won't so I don't.
  • Thanked: 75
  • Experience: Beginner
  • OS: Windows XP
Re: xcopy/copy refuses to use long file names
« Reply #1 on: January 23, 2007, 12:22:03 AM »
Have you tried just one set of "" such as

xcopy "c:\etc f:\etc" /v

and what with the \u - should that be /u  or is it part of the %1:-?

Welcome to the forums.
« Last Edit: January 23, 2007, 12:24:32 AM by Dusty »
One good deed is worth more than a year of good intentions.

Dan_Stephens

  • Guest
Re: xcopy/copy refuses to use long file names
« Reply #2 on: January 23, 2007, 07:15:52 PM »
I tried the following two both with and without the /v.  Don't see /v documented in help, but it didn't say invalid switch.  Verbose?

xcopy "C:\Program Files\USAPhotoMaps\USAPhotoMapsData\u%1*.*  F:\USAMaps\USAPhotoMapsData\" /v

xcopy "C:\Program Files\USAPhotoMaps\USAPhotoMapsData\u%1*.*"  "F:\USAMaps\USAPhotoMapsData\" /v

Still uses the short name.

With only one set of quotes like you had it said "invalid path", which kinda makes sense.  I figured you really meant 1 set of quotes around each path.

Yes, the "u" is part of the file name.

Naming convention is xnnymmmmm
x is one of 6 letters.
nn is a number between 10-19 inclusive
y is a constant "y"
mmmmm is a 5 digit sequential number

I want to copy all the files for xnn from one directory to another.

*******************************
WARNING!
<begin rule_violation="keep it short">
*******************************

You don't have to read this if you don't want, but here's the gory details.

I am downloading files from Terraserver using UASPhotoMaps and Terrafetcher.

x  It creates a separate set of files for each image type (B&W photo, Topo and color Urban photo).  For each of those, there are two sets, one for each of the two resolutions.  That's 6 sets, denoted by the six different letters the files begin with.

nn Then, each set is divided into a set for each UTM zone 10-19.

y  Just to keep the 2 numbers apart, I guess.

mmmmm  Then there's a separate file for each row of tiles downloaded.  Several thousand for each zone.  I now have about 80,000 files.  (Actually, for the higher resolutions this can be as much as 8 digits)

When the project progresses, and especially when I create two converted versions (georeferenced .jpgs and geoTiffs) these files will take up WAY more than I can fit on my little 200GB disk, so I need to spread them out to several 500GB drives.  Screwy part is, the programs will only read and D/L from the installed drive.

SO, I want to be able to copy an entire zone onto the install disk while I work on it.  AND have the option of copying in 2 zones to work between them both.  Then copying one or both back to work another place.  Hence passing the zone as a parameter.  I only showed one statement, but there'll actually be 6 copy statements, one for each of the 6 letters.

If someone doesn't come up with a solution, I may just create a directory for each zone and then just have to limit myself to working on one zone at a time.

-dan

Dan_Stephens

  • Guest
Re: xcopy/copy refuses to use long file names
« Reply #3 on: January 23, 2007, 07:35:16 PM »
Dusty,

Silly me.  The /v was just not alphabetical (as some others aren't).  v=verify of course.  I was using /y so I wouldn't get prompted for replacing.

Sorry, it's been years since I did anything in DOS.  I keep typing -y for switches and / for path separator.  But all that time on PC XTs is slowly coming back.

-dan

Dan_Stephens

  • Guest
Re: xcopy/copy refuses to use long file names
« Reply #4 on: January 23, 2007, 07:54:44 PM »
More details:

It's stranger than I thought.

Looking at the dir /x of the files that have been copied for zone 10:

All the files that were copied have EITHER the long name OR the short name starting with u10

Examples:
U10Y82~1   u10y82700.dta
U1884B6~1  u10y82799.dta
U10E99~1  u13y87564.dta

When using the /n switch, it displays the short name while copying.  Without the /n it displays the long name.

Stranger still, when using the /n, it STILL copies ones that don't match.  But it looses the long name when it does, as seen through dir /x or in Windows Explorer.

The original files show in the correct alphabetical order, so I don't think the directory is fried.  But it sure seems weird.

-dan

Dusty



    Egghead

  • I could if she would, but she won't so I don't.
  • Thanked: 75
  • Experience: Beginner
  • OS: Windows XP
Re: xcopy/copy refuses to use long file names
« Reply #5 on: January 24, 2007, 02:03:43 AM »
Sorry - it's been long hard day and I must confess you've got me on that one.

Quote
BTW, I have verified that the %1 parameter really contains what I expect.

Quote
Naming convention is xnnymmmmm
x is one of 6 letters.
nn is a number between 10-19 inclusive
y is a constant "y"
mmmmm is a 5 digit sequential number

I'm kinda puzzled by your use of a single % (percentage sign) which is not a wildcard so doesn't represent any letter/digit in the file name.  Seems to me that U1*.* would copy/xcopy every file in the 'U10ymmmmm' thru 'U19ymmmmm' range.  

However if you have SET 1=something then it's understandable except that you need to use the full %1% (leading and trailing percentage signs) in the filename.

Why does my tired brain keep giving me the message there's something I've missed and that I've just made a complete fool of myself - again:-?

Grrrrrrrr :-[
« Last Edit: January 24, 2007, 02:07:19 AM by Dusty »
One good deed is worth more than a year of good intentions.

Dan_Stephens

  • Guest
Re: xcopy/copy refuses to use long file names
« Reply #6 on: January 28, 2007, 06:49:23 PM »
Quote
Sorry - it's been long hard day and I must confess you've got me on that one.

Quote
BTW, I have verified that the %1 parameter really contains what I expect.

Quote
Naming convention is xnnymmmmm
x is one of 6 letters.
nn is a number between 10-19 inclusive
y is a constant "y"
mmmmm is a 5 digit sequential number

I'm kinda puzzled by your use of a single % (percentage sign) which is not a wildcard so doesn't represent any letter/digit in the file name.  Seems to me that U1*.* would copy/xcopy every file in the 'U10ymmmmm' thru 'U19ymmmmm' range.  

However if you have SET 1=something then it's understandable except that you need to use the full %1% (leading and trailing percentage signs) in the filename.

Why does my tired brain keep giving me the message there's something I've missed and that I've just made a complete fool of myself - again:-?

Grrrrrrrr :-[

I could have sworn I replied to this, but it's not there, so here goes again.

The %1 is parameter 1.  I call the .bat file and pass a number from 10-19 for the zone.

I'm thinking I'll just write something in C, though I bet it'll be much slower since I'll have to call the copy once for each file.

For now, I have just extracted the high resolution B&W photos out and an working on the other types.

I'm glad to see it has you confused as well.  Makes me feel not quite so dumb.

Thanks for you help, Dusty!

-dan


hunderson



    Newbie

    • Experience: Beginner
    • OS: Windows 7
    Re: xcopy/copy refuses to use long file names
    « Reply #7 on: April 18, 2017, 04:17:23 PM »
    Best and quick solution is to use (long_path_tool)

    patio

    • Moderator


    • Genius
    • Maud' Dib
    • Thanked: 1769
      • Yes
    • Experience: Beginner
    • OS: Windows 7
    Re: xcopy/copy refuses to use long file names
    « Reply #8 on: April 18, 2017, 06:10:57 PM »
    If he comes back...after 10 years i'm sure he'll appreciate it...
    " Anyone who goes to a psychiatrist should have his head examined. "