Page 1 of 3

clone file sctructure here

Posted: 02 Apr 2011 17:58
by tiago
Sometimes I would like to copy the whole file structure only (folders and files) like "create branches here" does but including the file names too while preserving original dates and attributes?
On the other hand, copy just the files stripping off any folder structure, appending suffixes in case of name collisions? I'm aware I could do a file search, right click and rich copy/move, but a submenu entry would do it faster.

Re: clone file sctructure here

Posted: 02 Apr 2011 19:25
by admin
You mean 0 bytes files?

Re: clone file sctructure here

Posted: 02 Apr 2011 20:37
by tiago
I guess that using no header at all would save disk space at the same time it will allow me to later open such files with notepad2 and write general notes on them, that way I'd kill two bunnies in a single shot. So yes, 0 bytes is a good idea!

Re: clone file sctructure here

Posted: 02 Apr 2011 20:56
by admin
Hm. Who will need this apart from you? :)

Re: clone file sctructure here

Posted: 02 Apr 2011 21:13
by tiago
Smart IT people who want to quickly audit and make notes on (irregular?) users' files locally to report abnormalities to their bosses without first running complicated tools to generate reports which need specific software to be opened... well, I bet you got the picture! ;)

Re: clone file sctructure here

Posted: 02 Apr 2011 23:14
by Stefan
I use this technic to save info about an folder from an test installation of an app.

I use an packer plugin of TC to generate an report of this folder in an text file.
Since TC can show archives as folders this technic is used to show this text file
as an kind of an archive and show the folder structure with o byte files
but with all infos as timestamp and attributes and size.
It's an kind of this catalog makers to scan an CD and store this as an file.


I tried this with XYplorer but i had no luck.

This is not recursive:
copytext report("{Dir {fullname}\|{fullname}|}<crlf>");

I have to code around it with

Code: Select all

$folderreport = folderreport
  foreach folder in $folderreport
    report("{Dir {fullname}\|{fullname}|}<crlf>");
And this i didn't get to work:
folderreport("dirs:{Dir {fullname}\|{fullname}|}", "c", , "r");


Once i had an list like:
X:\path\to\sub\folder\
X:\path\to\sub\folder\file.ext
X:\path\to\sub\folder\subfolder\
X:\path\to\sub\folder\subfolder\file.ext

i would make an code like

Code: Select all

ForEach Item In List
Remove ":"
If LastChar == "\"
 {
  new Item, dir
  }Else
 {
  new Item, file
  }

Re: clone file sctructure here

Posted: 03 Apr 2011 16:53
by tiago
Another practical usage for this: in case of suspicion on virus attack, I can quickly compare timestamps of a zipped, cloned dir against files which were not pointed as affected by regular AV but I suspect they were infected.
Or use such directories as honeypot, and in case of suspicion quickly verify mod dates and non-zero files where it's expected to have zero files only.

By reading Stefan's comment I must add that as far as I know no catalog software currently on market can do this so that would be another "XYplorer-only" function.

Re: clone file sctructure here

Posted: 03 Apr 2011 17:51
by DmFedorov
tiago
I use WhereIsIt to compare, although this program is intended primarily for other purposes. Of course if it did XY - it would be easier, more convenient and (judging by the speed of hash-md5) faster.
I always wondered why this work is done only cataloger-programs, because when it comes to your drive, in this case
logically - it is explorer work.

Re: clone file sctructure here

Posted: 03 Apr 2011 19:56
by admin
A new command in Paste Special called "Paste Folder and Files Structure" would do, right? Or anybody got a better name? E.g. "Paste Zero Byte Image"?

Re: clone file sctructure here

Posted: 03 Apr 2011 20:55
by tiago
"Paste Whole File Structure and Attribs, 0 Bytes"?
This implies "folders" while hint and clarifies that this will not be a "copy files" in any way.
Thank you very much for the implementation, Donald! I can think about other uses now it seems it'll be possible, and getting a script ready to implement the "append info" for the cases I mentioned I'll need to. Basically it reads info from pane X's selected file and write that into the currently selected file, the brand new clone as needed.

Re: clone file sctructure here

Posted: 03 Apr 2011 21:03
by admin
tiago wrote:"Paste Whole File Structure and Attribs, 0 Bytes"?
This implies "folders" while hint and clarifies that this will not be a "copy files" in any way.
Thank you very much for the implementation, Donald! I can think about other uses now it seems it'll be possible, and getting a script ready to implement the "append info" for the cases I mentioned I'll need to. Basically it reads info from pane X's selected file and write that into the currently selected file, the brand new clone as needed.
"Paste Whole File Structure and Attribs, 0 Bytes" ... ultraclumsy!

What's bad about "Paste Zero Byte Image"? Sounds slick.

Re: clone file sctructure here

Posted: 03 Apr 2011 21:15
by tiago
"Image" in case may mislead users non-familiar with the idea.
"Paste Zero Byte Structure"?

Re: clone file sctructure here

Posted: 03 Apr 2011 21:35
by Stefan
admin wrote:What's bad about "Paste Zero Byte Image"? Sounds slick.
How about "Paste As Zero Byte"?


- - -

Don, can you take an look at this issue:

This folderreport() example works:
text folderreport("dirs:{fullname}; {size kbr}; {modified yyyy-mm-dd}", "r", , "r");

But the "dir" template {Dir dir_value|file_value|drive_value} i don't get to work:
text folderreport("dirs:{dir {fullname}|{fullname}; {size kbr}; {modified yyyy-mm-dd}|}", "r", , "r");

I get always only the first format from the dir_value for all folders and files. The format from file_value is dropped.

But the help says it should work:
Help > folderreport() wrote:Types "tree" and "dirs" support a format template.
The template is appended to the "dirs"/"tree" selector separated by a ":" (colon),
and it fully supports the syntax of the template argument in report.

I want to get an recursive folderreport with different info from folders and files:
text folderreport("dirs:{dir {fullname} -add an \|{fullname}|}", "r", , "r");
X:\path\to\sub\folder -add an \
X:\path\to\sub\folder\file.ext
X:\path\to\sub\folder\subfolder -add an \
X:\path\to\sub\folder\subfolder\file.ext

Re: clone file sctructure here

Posted: 04 Apr 2011 10:30
by admin
But folderreport("dirs: ... only returns dirs. It makes no sense to use the dir_value | file_value switch on this output.

Re: clone file sctructure here

Posted: 04 Apr 2011 11:35
by Stefan
admin wrote:But folderreport("dirs: ... only returns dirs. It makes no sense to use the dir_value | file_value switch on this output.
:oops: Oh, of course, silly me. Sorry.