Hello!
$folder = get("SelectedItemsPathNames");
$filesinside = listfolder($folder, !"*.txt", 1, <crlf>);
$files = replace($filesinside, "\", "\\");
$textfileinside = $folder . "\filenames.txt";
$textfile = replace($textfileinside, "\", "\\");
writefile($textfile, $files);
I'm writing SelectedItemsPathNames of files(in subfolder) except for .txt of selected folder.
All fine, except for the fact that only files with 0 appear on the list, anyone knows the reason why?
from what i've tested:
xas\tires03\1_normal.jpg doesn't appear
xas\tires03\normal_123.jpg doesn't appear
xas\tires03\0_normal.jpg appears
xas\tires03\0123_normal.jpg appears
xas\tires03\normal_0123.jpg appears
appear - file path written to file
doesn't appear - file path not written to file
Any ideas? Thx!
only names with number 0 appears on file
-
jupe
- Posts: 3446
- Joined: 20 Oct 2017 21:14
- Location: Win10 22H2 120dpi
Re: only names with number 0 appears on file
listfolder doesn't accept boolean not, and you have it outside the quotes too, use an alternate method eg. quicksearch.
-
guimcast@gmail.com
- Posts: 10
- Joined: 04 Jun 2023 17:56
Re: only names with number 0 appears on file
Indeed! Thank you for the suggestion.
Posting the solution just in case another noob has the same doubt.
$folder = <curitem>;
$filesinside = quicksearch("*.jpg", $folder); // searching only for .jpg is ok for me.
$files = replace($filesinside, "\", "\\");
$textfileinside = $folder . "\filenames.txt";
$textfile = replace($textfileinside, "\", "\\");
writefile($textfile, $files); //
Posting the solution just in case another noob has the same doubt.
$folder = <curitem>;
$filesinside = quicksearch("*.jpg", $folder); // searching only for .jpg is ok for me.
$files = replace($filesinside, "\", "\\");
$textfileinside = $folder . "\filenames.txt";
$textfile = replace($textfileinside, "\", "\\");
writefile($textfile, $files); //
-
highend
- Posts: 14926
- Joined: 06 Feb 2011 00:33
- Location: Win Server 2022 @100%
Re: only names with number 0 appears on file
In that case you could have just used
listfolder($folder, "*.jpg", 1, <crlf>); as well^^One of my scripts helped you out? Please donate via Paypal
-
guimcast@gmail.com
- Posts: 10
- Joined: 04 Jun 2023 17:56
Re: only names with number 0 appears on file
Lol i agree with you.
Actually i just wanted to select the images files(in this case, all but .txt).
I ended up with:
$folder = <curitem>;
$filesinside = quicksearch("*.jpg;*.png;*.tga;*.tiff", $folder);
That way i know these are the only supported types, but i'd like to know how to use a file extension as exception. "!*.txt" doesnt work at all and I couldn't find another alternative.
I think quicksearch doesn't work with exceptions altho i remember to have seen it somewhere in the past
.
Maybe I'm just tripping, thanks for dropping by anyways
Actually i just wanted to select the images files(in this case, all but .txt).
I ended up with:
$folder = <curitem>;
$filesinside = quicksearch("*.jpg;*.png;*.tga;*.tiff", $folder);
That way i know these are the only supported types, but i'd like to know how to use a file extension as exception. "!*.txt" doesnt work at all and I couldn't find another alternative.
I think quicksearch doesn't work with exceptions altho i remember to have seen it somewhere in the past
Maybe I'm just tripping, thanks for dropping by anyways
-
jupe
- Posts: 3446
- Joined: 20 Oct 2017 21:14
- Location: Win10 22H2 120dpi
Re: only names with number 0 appears on file
Of course it works with exceptions, otherwise I wouldn't have suggested it.
but if you only want images anyway, then maybe this is better alternative in this case:
Code: Select all
$filesinside = quicksearch("!*.txt /Efn", $folder);Code: Select all
$filesinside = quicksearch("{:Image} /fn", $folder);
XYplorer Beta Club