[Solved] Report with all files on drive

Please check the FAQ (https://www.xyplorer.com/faq.php) before posting a question...
Post Reply
Sander Bouwhuis
Posts: 249
Joined: 10 Jun 2008 15:40
Location: Netherlands

[Solved] Report with all files on drive

Post by Sander Bouwhuis »

Hi all, I'm trying to create a report of all the files on my hard-disk. I need it when I make a backup of (some of) my files. By having the report of ALL the files I know exactly what I have lost after a hard-disk crash.

This is what I want:

Code: Select all

C:\My_file.txt     12345     2011-01-01 01:23:45
C:\MyDir\My_other_file.exe     54321     2010-02-02 01:23:45
C:\MyDir\MyOtherDir\Yet_another_file.png     666     2000-01-01 11:22:33
This is how far I got:

Code: Select all

::writefile("Index.txt", report("{fullname}<tab>{dir |{size RAW}<tab>{modified yyyy-mm-dd hh:mm:ss}|}<crlf>"))
I have 3 questions:
1. How can I remove the directories? I.e., I ONLY want to see the files.
2. How can I go into sub-directories? I.e., I want ALL the files on my hard-disk.
3. How can I automatically name the report as 'C.txt' for the C:\ drive, and 'D.txt' for the D:\ driver etc.?


Thank you very much in advance for any help.
Last edited by Sander Bouwhuis on 16 Feb 2011 12:36, edited 1 time in total.
(\__/)
(='.'=) This is Bunny. Copy and paste bunny into
(")_(") your signature to help him gain world domination.

Stefan
Posts: 1360
Joined: 18 Nov 2008 21:47
Location: Europe

Re: Report with all files on drive

Post by Stefan »

iycgtptyarvg wrote: I have 3 questions:
1. How can I remove the directories? I.e., I ONLY want to see the files.
2. How can I go into sub-directories? I.e., I want ALL the files on my hard-disk.
3. How can I automatically name the report as 'C.txt' for the C:\ drive, and 'D.txt' for the D:\ driver etc.?
1.)
see report() parameter {Dir ||}
{Dir do this for dirs | do this for files | do this for drives}
::text report("{dir |{fullname}<tab>{size RAW}<tab>{modified yyyy-mm-dd hh:mm:ss}|}<crlf>");

But this write empty lines for each directory to the output.
I miss here an option to use an placeholder like @ to just skip folders and print NO empty line, like
::text report("{dir @|{fullname}<tab>{size RAW}<tab>{modified yyyy-mm-dd hh:mm:ss}|}<crlf>");

You could use something like
::text report("{dir Dir line, delete me|{fullname}<tab>{size RAW}<tab>{modified yyyy-mm-dd hh:mm:ss}|}<crlf>");
and delete this lines afterwards.

Or we have to use more then an one-liner script.


2.) Go to the root of the drive, then select "Edit > Show all Items in Branch" (could take some time???)


3.) i wanted to say: "Help > XYplorer Native Variables > <curdrive>
like
::writefile("<curdrive>.txt", report(...
but this var is not supported as far as i see.

But since you are in the root of the drive you can use <curfolder> to get f.e. "C"
Test: in C:\ >>> ::msg "<curfolder>.txt";
::writefile("<curfolder>.txt", report(...

Hope this is from some help.

Sander Bouwhuis
Posts: 249
Joined: 10 Jun 2008 15:40
Location: Netherlands

Re: Report with all files on drive

Post by Sander Bouwhuis »

Thank you for your reply. The 'Show All Items In Branch' tip was a good one.

I actually also discovered you could do some of the 'To clipboard' stuff. But none are perfect (that's why I wanted to use a script).
Also, the 'Report/Extended info' is not bad, but is not configurable.

For now, I'll just go for the 'Report/Extended info' thingy, because I need to be able to do this quickly when making my weekly backup.
Is there a way I can create a script to automatically launch the 'Report/Extended info' for drive C:\, D:\ and E:\ ?
(\__/)
(='.'=) This is Bunny. Copy and paste bunny into
(")_(") your signature to help him gain world domination.

Stefan
Posts: 1360
Joined: 18 Nov 2008 21:47
Location: Europe

Re: Report with all files on drive

Post by Stefan »

iycgtptyarvg wrote:Is there a way I can create a script to automatically launch the 'Report/Extended info' for drive C:\, D:\ and E:\ ?
You mean something like

Code: Select all

goto "C:";
   #263; //List all items the current branch
   writefile("C:\List of <curfolder> from <date yyyy-mm-dd>.txt", report(...
   
   goto "D:";
   #263; //List all items the current branch
   writefile("C:\List of <curfolder> from <date yyyy-mm-dd>.txt", report(...
   
   goto "E:";
   #263; //List all items the current branch
   writefile("C:\List of <curfolder> from <date yyyy-mm-dd>.txt", report(...

Sander Bouwhuis
Posts: 249
Joined: 10 Jun 2008 15:40
Location: Netherlands

Re: Report with all files on drive

Post by Sander Bouwhuis »

Ok, I'm probably very stupid :oops:, but I can't get the script to work even though I followed your suggestions.

I have this in a file called "E:\Storage\Settings\XYplorer Backup Drive Structure.xys"

Code: Select all

goto "C:";
#263; //List all items the current branch
writefile("E:\C Drive Structure.txt", report("{fullname}<tab>{dir |{size RAW}<tab>{modified yyyy-mm-dd hh:mm:ss}|}<crlf>"));

goto "D:";
#263; //List all items the current branch
writefile("E:\D Drive Structure.txt", report("{fullname}<tab>{dir |{size RAW}<tab>{modified yyyy-mm-dd hh:mm:ss}|}<crlf>"));

goto "E:";
#263; //List all items the current branch
writefile("E:\E Drive Structure.txt", report("{fullname}<tab>{dir |{size RAW}<tab>{modified yyyy-mm-dd hh:mm:ss}|}<crlf>"));
When I try to run this using 'Scripting/Run script...' it says 'Invalid script'.
When I try to run this using 'User/Run script/Backup Drive Structure', I get a popup menu where I have to select one of the commands :shock:

:oops: I'm clearly doing something wrong, but I don't know what. :oops:
(\__/)
(='.'=) This is Bunny. Copy and paste bunny into
(")_(") your signature to help him gain world domination.

Stefan
Posts: 1360
Joined: 18 Nov 2008 21:47
Location: Europe

Re: Report with all files on drive

Post by Stefan »

iycgtptyarvg wrote:I'm clearly doing something wrong, but I don't know what.
No, i just didn't provide you an valid script, but just an idea. Sorry for that :lol:

You have to know how an script have to be formated:

see Help > Advanced Topics > Scripting > Syntax rules for XYplorer Script Files

* only the very first line of an script must start at pos1,
all other lines of an script are indented by at least one space and start at pos2 or more.
IF this first line is just an description/header between quotes "" then you get an popup menu with one single item to start the script.
IF the first line is not quoted but the first command then the script just starts without any prompt.
* an script file (may) contain several scripts with several lines starting at pos1 (one for each script)
and so provide you an popup menu to select one of this scripts inside.


Furthermore my script is untested since i didn't need such an script, but should work as far as i see.


Here is your script well formated:

Code: Select all

"Backup Drive Structure"

    goto "C:";
    #263; //List all items the current branch
    writefile("E:\C Drive Structure.txt", 
                   report("{fullname}<tab>{dir |{size RAW}<tab>{modified yyyy-mm-dd hh:mm:ss}|}<crlf>"));

    goto "D:";
    #263; //List all items the current branch
    writefile("E:\D Drive Structure.txt", 
                   report("{fullname}<tab>{dir |{size RAW}<tab>{modified yyyy-mm-dd hh:mm:ss}|}<crlf>"));

    goto "E:";
    #263; //List all items the current branch
    writefile("E:\E Drive Structure.txt", 
                   report("{fullname}<tab>{dir |{size RAW}<tab>{modified yyyy-mm-dd hh:mm:ss}|}<crlf>"));


Sander Bouwhuis
Posts: 249
Joined: 10 Jun 2008 15:40
Location: Netherlands

Re: Report with all files on drive

Post by Sander Bouwhuis »

Ok, I managed to get it to work. This is what I ended up with:

Code: Select all

"Backup Drive Structure"

    goto "C:\?* /rf";
    sortby Name, a;
    sortby Path, a;
    writefile("E:\Drive Structure.csv", report("{fullname}<tab>{size RAW}<tab>{modified yyyy-mm-dd hh:mm:ss}<crlf>"),o);

    goto "D:\?* /rf";
    sortby Name, a;
    sortby Path, a;
    writefile("E:\Drive Structure.csv", report("{fullname}<tab>{size RAW}<tab>{modified yyyy-mm-dd hh:mm:ss}<crlf>"),a);

    goto "E:\?* /rf";
    sortby Name, a;
    sortby Path, a;
    writefile("E:\Drive Structure.csv", report("{fullname}<tab>{size RAW}<tab>{modified yyyy-mm-dd hh:mm:ss}<crlf>"),a);
Note that the first 'writefile' statement overwrites any existing file, and the subsequent ones append to the file.

I'm not sure whether XYplorer supports stable-sort. I.e., by first sorting on name and then on path you should have all files alphabetically ordered. Only sorting by path could leave the files within the same folder unsorted.

Stefan, thank you very much for helping me out. Without your help I would surely have given up. :thumbsup: :applause: :hail:
(\__/)
(='.'=) This is Bunny. Copy and paste bunny into
(")_(") your signature to help him gain world domination.

admin
Site Admin
Posts: 66361
Joined: 22 May 2004 16:48
Location: Win8.1, Win10, Win11, all @100%
Contact:

Re: Report with all files on drive

Post by admin »

iycgtptyarvg wrote:Hi all, I'm trying to create a report of all the files on my hard-disk. I need it when I make a backup of (some of) my files. By having the report of ALL the files I know exactly what I have lost after a hard-disk crash.

This is what I want:

Code: Select all

C:\My_file.txt     12345     2011-01-01 01:23:45
C:\MyDir\My_other_file.exe     54321     2010-02-02 01:23:45
C:\MyDir\MyOtherDir\Yet_another_file.png     666     2000-01-01 11:22:33
Note that I liked the concept and added "Basic info to CSV" that works along these lines.
It will be made accessible through scripting later...

Sander Bouwhuis
Posts: 249
Joined: 10 Jun 2008 15:40
Location: Netherlands

Re: Report with all files on drive

Post by Sander Bouwhuis »

Time and again I'm surprised by your close involvement with the community. It's a very rare thing indeed that companies actually listen to their customers and give them feedback.

Big praise to you!
(\__/)
(='.'=) This is Bunny. Copy and paste bunny into
(")_(") your signature to help him gain world domination.

admin
Site Admin
Posts: 66361
Joined: 22 May 2004 16:48
Location: Win8.1, Win10, Win11, all @100%
Contact:

Re: Report with all files on drive

Post by admin »

iycgtptyarvg wrote:Time and again I'm surprised by your close involvement with the community. It's a very rare thing indeed that companies actually listen to their customers and give them feedback.

Big praise to you!
Thanks! :D (Of course, it not only listening to customers, but also a) I can use it myself, and b) it might help selling more units...)

Your job could now look similar to this example:

Code: Select all

"Report Folders Contents"
  folderreport("bcsv", "file", "E:\Test\a", "r", "E:\Test\Contents a.csv");
  folderreport("bcsv", "file", "E:\Test\b", "r", "E:\Test\Contents b.csv");

Sander Bouwhuis
Posts: 249
Joined: 10 Jun 2008 15:40
Location: Netherlands

Re: Report with all files on drive

Post by Sander Bouwhuis »

I couldn't find the command 'folderreport' in the documentation.
Could you please show me what each parameter does?
(\__/)
(='.'=) This is Bunny. Copy and paste bunny into
(")_(") your signature to help him gain world domination.

admin
Site Admin
Posts: 66361
Joined: 22 May 2004 16:48
Location: Win8.1, Win10, Win11, all @100%
Contact:

Re: Report with all files on drive

Post by admin »

iycgtptyarvg wrote:I couldn't find the command 'folderreport' in the documentation.
Could you please show me what each parameter does?
Please download the change log: http://www.xyplorer.com/download/History.txt

Sander Bouwhuis
Posts: 249
Joined: 10 Jun 2008 15:40
Location: Netherlands

Re: Report with all files on drive

Post by Sander Bouwhuis »

Ok, I got it to work.

For those who are interested, this is the result:

Code: Select all

"Backup Drive Structure"
  folderreport("bcsv", "file", "C:\", "r",  "E:\Storage\Documents\Drive Structure.csv");
  folderreport("bcsv", "file", "D:\", "ra", "E:\Storage\Documents\Drive Structure.csv");
  folderreport("bcsv", "file", "E:\", "ra", "E:\Storage\Documents\Drive Structure.csv");
(\__/)
(='.'=) This is Bunny. Copy and paste bunny into
(")_(") your signature to help him gain world domination.

Post Reply