include the value of the size of each file

Things you’d like to miss in the future...
Forum rules
You might want to read this if you're looking for priority service

:info: Please Include The Following Information
1) Your XYplorer Version (e.g., v28.00.0801)
2) Your Windows Version (e.g., Win 11)
3) Your Screen Scaling Percentage (e.g., 125%).

:info: Use Your Profile Or Signature
We strongly recommend adding your Windows Version and Screen Scaling Percentage to the Location field in your Profile or to your Signature. That way, you only have to type them once, and we won't have to search for that vital information.

:info: How To Attach Images
When attaching an Image, please use the Attachment tab at the bottom of your post and click "Add files".
Post Reply
adisaputra
Posts: 11
Joined: 17 Dec 2015 23:00

include the value of the size of each file

Post by adisaputra »

> Hello.. just little Question.
> <datem yyyy.mm.dd> result: 2015.12.18
> Can you help me, i want include the value of the size of each file : 2015.12.18_563128_bytes.
> :roll: :roll: :roll:
> Thanks.

highend
Posts: 15016
Joined: 06 Feb 2011 00:33
Location: Win Server 2022 @100%

Re: include the value of the size of each file

Post by highend »

Code: Select all

    $list = "";
    foreach($file, <get SelectedItemsPathNames |>) {
        $props = "<datem yyyy.mm.dd>_" . property("size", $file) . "_bytes";
        $list = $list . $file . " - " . $props . <crlf>;
    }
    text $list;
Something like this?
One of my scripts helped you out? Please donate via Paypal

adisaputra
Posts: 11
Joined: 17 Dec 2015 23:00

Re: include the value of the size of each file

Post by adisaputra »

highend wrote:

Code: Select all

    $list = "";
    foreach($file, <get SelectedItemsPathNames |>) {
        $props = "<datem yyyy.mm.dd>_" . property("size", $file) . "_bytes";
        $list = $list . $file . " - " . $props . <crlf>;
    }
    text $list;
Something like this?
Sorry my explanation less, I want to change the name of each file to be 2015.12.18_563128_bytes
Can you help me if i for this?

bdeshi
Posts: 4256
Joined: 12 Mar 2014 17:27
Location: Asteroid B-612
Contact:

Re: include the value of the size of each file

Post by bdeshi »

select the files to rename and then run this script. (You can just paste this into the addressbar then press ENTER)

Code: Select all

::foreach($f, <selitems |>){ renameitem( formatdate(property('System.DateModified',$f), 'yyyy.dd.mm').'_'.filesize($f).'_bytes', $f, 1+4 ); };
edit: was using the creation date, instead of modification.
Icon Names | Onyx | Undocumented Commands | xypcre
[ this user is asleep ]

adisaputra
Posts: 11
Joined: 17 Dec 2015 23:00

Re: include the value of the size of each file

Post by adisaputra »

SammaySarkar wrote:select the files to rename and then run this script. (You can just paste this into the addressbar then press ENTER)

Code: Select all

::foreach($f, <selitems |>){ renameitem( formatdate(property('System.DateCreated',$f), 'yyyy.dd.mm').'_'.filesize($f).'_bytes', $f, 1+4 ); };

SammaySarkar, thanks for your help.
Can you help me again, i want rename each file to : 2015.12.18_16.10.32.123_563128_bytes.
NOTE:
2015.12.18 is date
16.10.32.123 is time with millisecond
563128_bytes is size of file.

Please help me again. Thanks SammaySarkar.. :appl: :appl: :appl: :appl: :appl: :appl:

bdeshi
Posts: 4256
Joined: 12 Mar 2014 17:27
Location: Asteroid B-612
Contact:

Re: include the value of the size of each file

Post by bdeshi »

Then use this.

Code: Select all

::foreach($f, <selitems |>){ renameitem(report('{Modified yyyy.mm.dd_hh.nn.ss.fff}', $f).'_'.filesize($f).'_bytes', $f, 5); };
Icon Names | Onyx | Undocumented Commands | xypcre
[ this user is asleep ]

adisaputra
Posts: 11
Joined: 17 Dec 2015 23:00

Re: include the value of the size of each file

Post by adisaputra »

SammaySarkar wrote:Then use this.

Code: Select all

::foreach($f, <selitems |>){ renameitem(report('{Modified yyyy.mm.dd_hh.nn.ss.fff}', $f).'_'.filesize($f).'_bytes', $f, 5); };

THANK YOU VERY MUCH.. SammaySarkar :appl: :appl: :appl: :appl:

Post Reply