Recent

Author Topic: Copying an entire directory (incl. subdirectories)  (Read 19973 times)

bastla

  • New Member
  • *
  • Posts: 23
Re: Copying an entire directory (incl. subdirectories)
« Reply #15 on: August 10, 2013, 08:56:38 pm »
Thanks!
I added a small note to the start post, hopefully everybody will notice your post.

Caladan

  • New member
  • *
  • Posts: 5
Re: Copying an entire directory (incl. subdirectories)
« Reply #16 on: January 03, 2014, 06:36:36 pm »
this is so close to what I been looking for, thank you !

1 error in the source though

line 278
{$IFDEF Unix} self._copyAttributes := false;
    {$ELSE} self._preserveAttributes := true {$ENDIF};

assume that should be _preseriveAttributes on the 1st line.

also it does not copy all file atributes under linux, for example tis not copying the executable flag, will see if I can find a solution for that.

bastla

  • New Member
  • *
  • Posts: 23
Re: Copying an entire directory (incl. subdirectories)
« Reply #17 on: January 05, 2014, 01:13:37 pm »
Hi Caladan,

yes, your're right, it should be
Code: [Select]
  {$IFDEF Unix} self._preserveAttributes := false; in line 278. I'm sorry for that error! May I link your post to the start post so that everybody will see the bug?

Unfortunately, I'm not an excessive Linux user, so I don't know much about coding on Linux. That's why I can't figure out how to handle file attributes on Linux. It would be great if you could find a solution on how to read and set all those file attributes!

Greetings,
bastla

Caladan

  • New member
  • *
  • Posts: 5
Re: Copying an entire directory (incl. subdirectories)
« Reply #18 on: January 05, 2014, 01:29:43 pm »
feel free to link.

Well with fpchmod you can set the correct attributes but I have yet to find a way to get them from the original file.... so far unlucky to find a command or way to get them.

bastla

  • New Member
  • *
  • Posts: 23
Re: Copying an entire directory (incl. subdirectories)
« Reply #19 on: June 03, 2014, 09:50:06 pm »
Time to push this once again! :D
I uploaded a new version fixing bugs found by onivan and Caladan! Thank you very much!

Cheers,
bastla

aducom

  • Full Member
  • ***
  • Posts: 128
    • http://www.aducom.com
Re: Copying an entire directory (incl. subdirectories)
« Reply #20 on: April 05, 2015, 09:26:27 am »
Only one remark, the class is using TList as an array of string. If you have a TList in your application than that might interfere. Just change it to TListString and no conflicts any more. I know this is an old post, but a very useful one.

nogo

  • New member
  • *
  • Posts: 5
Re: Copying an entire directory (incl. subdirectories)
« Reply #21 on: July 30, 2015, 01:57:08 pm »
For me copying of files in a hidden folder does not work on Windows

kind regards,

nogo

Alextp

  • Hero Member
  • *****
  • Posts: 1123
    • UVviewsoft
Re: Copying an entire directory (incl. subdirectories)
« Reply #22 on: August 15, 2015, 01:12:30 pm »
Used in CudaText now. Thax... (note: I made error and wrote srcdir==todir, and unit created empty dir. better check SameFilename (Win32 aware) and don't do.)

eac

  • Newbie
  • Posts: 1
Re: Copying an entire directory (incl. subdirectories)
« Reply #23 on: August 23, 2015, 08:53:09 pm »
Excellent job here, indeed!  :)

But I have a newbie question.
How could I do to keep the creation date of the files?
Because putting
CopyDir.PreserverFileDates := true;
wasn't helpful for me :(

Thanx!

Alextp

  • Hero Member
  • *****
  • Posts: 1123
    • UVviewsoft
Re: Copying an entire directory (incl. subdirectories)
« Reply #24 on: October 30, 2015, 07:26:53 am »
Please: feature-request

I want to copy folder A to B but only those files in A, which don't exist in B or newer than files in B-
ie, I need option "CopyOnlyNewerFiles" - can you add, pls?

Alextp

  • Hero Member
  • *****
  • Posts: 1123
    • UVviewsoft
Re: Copying an entire directory (incl. subdirectories)
« Reply #25 on: June 09, 2020, 12:57:58 am »
My fork, some changes
- some LCL usual type was redefined??? bad. fixed to TDirsArray
- "const" string params
- removed too much logging

https://github.com/Alexey-T/CudaText/blob/master/comp/copydir.pas

 

TinyPortal © 2005-2018