The following warnings occurred:
Warning [2] count(): Parameter must be an array or an object that implements Countable - Line: 895 - File: showthread.php PHP 7.2.34 (Linux)
File Line Function
/showthread.php 895 errorHandler->error




Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
How to extract files from a folder?
#1
Hi,

I have n files in a folder, they are named by number such as: 1.jpg, 2.jpg, 3.jpg, 4.jpg and so on, for example, until 30.jpg.

I would like to extract into a new folder files in increments of 3,  such as 1.jpg, 4.jpg, 7.jpg, 10.jpg, and so on.

I wrote the script below:

int i
ARRAY(str) a
GetFilesInFolder a "$Desktop$\I1\" ""
a.sort(8)

for i 0 a.len
,str s1=a[i]
,out s1    ;;ORIGIN FILES
,str s2=F"C:\Users\emers\Desktop\I2\{i+1}.jpg"
,out s2    ;;DESTINATION FOLDER
, ren s1 s2

but that would move ALL the files to folder I2.

Could someone tell how this works?
Thank you
Emerson


Messages In This Thread
How to extract files from a folder? - by Emerson - 07-31-2019, 01:08 AM

Forum Jump:


Users browsing this thread: 1 Guest(s)