Author Topic: Moving Folders  (Read 4486 times)

0 Members and 1 Guest are viewing this topic.

cmwade77

  • Swamp Rat
  • Posts: 1443
Moving Folders
« on: August 13, 2012, 05:39:39 PM »
Ok, I have a situation here, perhaps someone can help me, I have a lot of folders named Archive or Archived on my server that I need to move from that server to a drive on another server.

The paths need to remain the same, except for the drive letter (or server name). I have not yet found anything that allows this to be done.

I know this is not directly related to AutoCAD or LISP, but I know you guys might have something that works. I am open to this being done in LISP, VB.NET, Apple Script, Automator, a third party tool for Windows, Mac or Linux, basically whatever can get the job done.

I have tried writing my own; however, it turns out that some of the path names are too long for Windows (this was before we had a mixed environment too, so not sure how that happened) and so my toll would error out when that happens. I managed to get it to skip the errors; however, those folders need to be moved as well.

Keith™

  • Villiage Idiot
  • Seagull
  • Posts: 16899
  • Superior Stupidity at its best
Re: Moving Folders
« Reply #1 on: August 13, 2012, 05:48:49 PM »
Hmmm .. can you not simply drag and drop the entire folder structure from the source machine to the destination machine? If you do, the folders are automatically recreated in the same location as on the source.
Proud provider of opinion and arrogance since November 22, 2003 at 09:35:31 am
CadJockey Militia Field Marshal

Find me on https://parler.com @kblackie

ronjonp

  • Needs a day job
  • Posts: 7531
Re: Moving Folders
« Reply #2 on: August 13, 2012, 05:54:39 PM »
XCOPY  :-P

Windows 11 x64 - AutoCAD /C3D 2023

Custom Build PC

cmwade77

  • Swamp Rat
  • Posts: 1443
Re: Moving Folders
« Reply #3 on: August 13, 2012, 05:59:37 PM »
XCOPY  :-P
XCOPY doesn't seem to have a move option, nor a way to say I only want folders named Archive or Archived and all such folders.

Lee Mac

  • Seagull
  • Posts: 12924
  • London, England
Re: Moving Folders
« Reply #4 on: August 13, 2012, 06:04:20 PM »
IIRC vl-file-rename should work to move folders, though, I haven't tested it across drives... /disclaimer

EDIT: ignore the above, vl-file-rename can only rename the lowest folder in the directory tree.
« Last Edit: August 13, 2012, 06:09:51 PM by Lee Mac »

cmwade77

  • Swamp Rat
  • Posts: 1443
Re: Moving Folders
« Reply #5 on: August 13, 2012, 06:09:59 PM »
Hmmm .. can you not simply drag and drop the entire folder structure from the source machine to the destination machine? If you do, the folders are automatically recreated in the same location as on the source.
Um, that would be a lot of folders, I want to move all Archive folders (and their contents) from we'll say Drive H: to Drive T: (or \\Server1 to \\Server2) with the remainder of the path remaining the same, so lets say that I have the following folder:
H:\Projects\Small Jobs\Archived

I would want that folder MOVED to:
T:\Projects\Small Jobs\Archived

IIRC vl-file-rename should work to move folders, though, I haven't tested it across drives... /disclaimer
I did look at that, but it doesn't seem to work across drives, but I will look again to see if I missed something.

danallen

  • Guest
Re: Moving Folders
« Reply #6 on: August 13, 2012, 06:12:20 PM »
Try beyond compare by scooter software, has full function trial that will do what you need. You can filter by folder or file names, or any other attribute, date, etc.

http://www.scootersoftware.com/index.php

update - just to test the function, the filtering folder syntax is fussy, use "...\archive\" in the include folders dialog
« Last Edit: August 13, 2012, 09:08:09 PM by danallen »

kruuger

  • Swamp Rat
  • Posts: 637
Re: Moving Folders
« Reply #7 on: August 13, 2012, 06:49:13 PM »
Where is the problem  :-o
just drag all folders like Keith said.
of course need to wait until all files will be moved.
k.

cmwade77

  • Swamp Rat
  • Posts: 1443
Re: Moving Folders
« Reply #8 on: August 13, 2012, 06:52:30 PM »
Where is the problem  :-o
just drag all folders like Keith said.
of course need to wait until all files will be moved.
k.
Again, I do not want to move anything that is not in an Archive folder, so dragging and dropping does not work, as that would move everything.

Kerry

  • Mesozoic relic
  • Seagull
  • Posts: 11654
  • class keyThumper<T>:ILazy<T>
Re: Moving Folders
« Reply #9 on: August 13, 2012, 07:52:01 PM »

Make a batch file
Code: [Select]
:: MOVESTUFF.BAT
:: kdub@theSwamp
:: MD "D:\Projects\Small Jobs\Archived\"
XCOPY /Y /E "K:\Projects\Small Jobs\Archived\*.*" "D:\Projects\Small Jobs\Archived\"
RD  /S /Q "K:\Projects\Small Jobs\Archived"
kdub, kdub_nz in other timelines.
Perfection is not optional.
Everything will work just as you expect it to, unless your expectations are incorrect.
Discipline: None at all.

cmwade77

  • Swamp Rat
  • Posts: 1443
Re: Moving Folders
« Reply #10 on: August 13, 2012, 07:53:54 PM »

Make a batch file
Code: [Select]
:: MOVESTUFF.BAT
:: kdub@theSwamp
:: MD "D:\Projects\Small Jobs\Archived\"
XCOPY /Y /E "K:\Projects\Small Jobs\Archived\*.*" "D:\Projects\Small Jobs\Archived\"
RD  /S /Q "K:\Projects\Small Jobs\Archived"
Ok, but that was only an example, I also have Archived folders in probably around 350-400 subfolders (not just Small Jobs), this is where everything seems to fail.

owenwengerd

  • Bull Frog
  • Posts: 451
Re: Moving Folders
« Reply #11 on: August 13, 2012, 08:58:03 PM »
This is exactly the type of scenario that ROBOCOPY was designed for.

kruuger

  • Swamp Rat
  • Posts: 637
Re: Moving Folders
« Reply #12 on: August 14, 2012, 01:04:21 AM »
This is exactly the type of scenario that ROBOCOPY was designed for.
x2

Code: [Select]
Robocopy.exe "H:\Projects\Small Jobs\Archived" "T:\Projects\Small Jobs\Archived" /E /V /NP /Z /R:0 /W:0 /XD "*Archive"
k.

irneb

  • Water Moccasin
  • Posts: 1794
  • ACad R9-2016, Revit Arch 6-2016
Re: Moving Folders
« Reply #13 on: August 14, 2012, 08:48:34 AM »
... it turns out that some of the path names are too long for Windows (this was before we had a mixed environment too, so not sure how that happened) ...
Could you explain what's going on? Also what systems are in this "mixed" environment.

AFAIK windows (if you use NTFS file systems - not one of the FAT based file systems) has no restriction on path length (or none that should matter). Some programs use old / custom libraries linking to Windows' file system (I think portions of acad falls into this category) - which might then error with path lengths are in excess of around 250 characters. That might thus propagate the error into AutoLisp - it's definitely not AutoLisp having a restriction on string lengths (I've tested this before and it works fine with strings up to around 200,000,000 characters).

If your "mixed" environment is linux servers, Mac's, NAS, etc. Then they may have some restrictions as well - also depending on the file system(s) they use. Note Linux & NAS (Network Attached Storage - usually using Linux/BSD as operating system) have a plethora of filesystems to choose from. You will have to make a decision if this is where your error occurs:
  • Change all your paths to be less verbose: Rather than naming a folder like .../Job#12345 - Job's Full Description/Plans of Area 10/... use the minimum unique portion from that, e.g. .../12345/Plans-10/...
  • Choose a different filesystem which can handle these extremely long paths.
If you don't follow one or both those options, it won't only be your archiving which breaks apart.
Common sense - the curse in disguise. Because if you have it, you have to live with those that don't.

VovKa

  • Water Moccasin
  • Posts: 1632
  • Ukraine
Re: Moving Folders
« Reply #14 on: August 14, 2012, 11:09:40 AM »
why not use a file manager (FAR or alike)?