-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcopyfiles2.sce
More file actions
49 lines (41 loc) · 1.81 KB
/
Copy pathcopyfiles2.sce
File metadata and controls
49 lines (41 loc) · 1.81 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
clear;
WRK_PATH = "D:\VISUEL\CREATIONS\SAINT-DROP\VIsuels INSTRUS\VIDEOS";
RES_PATH = "D:\VISUEL\CREATIONS\SAINT-DROP\VIsuels INSTRUS\VIDEOS\IMG";
//make directory
mkdir(RES_PATH);
//search for directory to find in
allFiles = listfiles(WRK_PATH);
for iDir = 1:size(allFiles, 1)
thisDir = allFiles(iDir);
thisDirFname = fullfile(WRK_PATH, thisDir);
if thisDirFname <> "D:\VISUEL\CREATIONS\SAINT-DROP\VIsuels INSTRUS\VIDEOS\IMG" then
//check if its a dir
if isdir(thisDirFname) then
//find for jpg
allJPGnames = findfiles(thisDirFname, "*.jpg");
for iJPG = 1:size(allJPGnames, 1)
thisJPGname = allJPGnames(iJPG);
//copy
if isempty(grep(thisJPGname, "YT")) then
thisJPGFname = fullfile(thisDirFname, thisJPGname);
[path, fname, extension] = fileparts(thisJPGname);
thisJPGFname_new = fullfile(RES_PATH, fname+"_"+string(iDir)+extension);
copyfile(thisJPGFname, thisJPGFname_new);
end
end
//find for png
allPNGnames = findfiles(thisDirFname, "*.png");
for iPNG = 1:size(allPNGnames, 1)
thisPNGname = allPNGnames(iPNG);
//copy
if isempty(grep(thisPNGname, "YT")) then
thisPNGFname = fullfile(thisDirFname, thisPNGname);
[path, fname, extension] = fileparts(thisPNGname);
thisPNGFname_new = fullfile(RES_PATH, fname+"_"+string(iDir)+extension);
copyfile(thisPNGFname, thisPNGFname_new);
end
end
disp(string(iDir)+" sur "+string(size(allFiles, 1)));
end
end
end