Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Filename and folder partial matching and move
#1
Filename partial match finding and partial matching folder move?

Ex:
Filename :
"ID=11059 l Title=American Eagle.jpg"
"ID=11019 l Title=American Eagle.jpg"
"ID=10119 l Title=American Eagle.jpg"
"ID=12285 l Title=Kingdoms.jpg"
"ID=12059 l Title=American Eagle.jpg"
"ID=12085 l Title=Three Kingdoms.jpg"
"ID=10059 l Title=American Eagle.jpg"
"ID=23501 l Title=American Eagle.jpg"

Foldername : kingdoms


partial matching = Filename "kingdoms" same Foldername "kingdoms"
Foldername kingdoms *.jpg multi move
Is it possible?
#2
quick and dirty, need tweaks and checking tests but should help out of the box

Macro Macro20
Code:
Copy      Help
str s=
;ID=11059 l Title=American Eagle.jpg
;ID=11019 l Title=American Eagle.jpg
;ID=10119 l Title=American Eagle.jpg
;ID=12285 l Title=Kingdoms.jpg
;ID=12059 l Title=American Eagle.jpg
;ID=12085 l Title=Three Kingdoms.jpg
;ID=10059 l Title=American Eagle.jpg
;ID=23501 l Title=American Eagle.jpg

;input for pattern to search for
str name
int ok=inp(name "Word to find" "Word to find")

;where to search
str location
BrowseForFolder(&location "" 5)

;enum files
ARRAY(str) a
GetFilesInFolder a location "*.jpg" 0

;get jpg files
ARRAY(str) b
for _i 0 a.len
,if(find(a[_i] name 0 1)!=-1)
,,b[]=a[_i]

;create folder named by searched word
if(b.len)
,_s.from(location "\" name)
,mkdir _s

;move files matching pattern
for _i 0 b.len
,ren b[_i] _s

Hope you'll find useful....
#3
Thankyou! So much! Big Grin Big Grin

make already created folder and filename Finding and matching folder move
Is it possible?
#4
Sorry, i don't understand your question...
#5
Is this what you want?

Macro Kingdoms
Code:
Copy      Help
;input for pattern to search for
str name
int ok=inp(name "Enter Partial Filename" "Name to search")

;search folder
str location
BrowseForFolder(&location "" 5)

;enumerate files
ARRAY(str) a
GetFilesInFolder a location _s.from("*" name "*") 2

;show results
str dirname=location
if(location.getfilename=name) out dirname
out a
#6
I'm sorry. I'm don't know speak English.

1). I make several folder with excel strings.
2). and find files. which are identical several folder with excel string.
3). These are automatically move each folder.
4). and string which are same jpg file name, automatically move compare with already made folder.


1. Made multiple name folders in excel string.
Quote:Create TitleFolder
int row
ExcelSheet TitleFolder.Init("")
TitleFolder.Activate

ARRAY(str) OriTitle
foreach OriTitle TitleFolder FE_ExcelSheet_Row "F2:F500"
OriTitle[0].replacerx("([!-,./?])" "")
OriTitle[0].replacerx(" " "")
mkdir F"{OriTitle[0]}" DataFolder
[Image: file.php?mode=view&id=689&sid=8fe1594fe1...8ed9fb5fb7]

2. *.jpg file name
[Image: file.php?mode=view&id=690&sid=8fe1594fe1...8ed9fb5fb7]

3. "B.jpg" same folder name( "B") -> auto move


Attached Files Image(s)
       
#7
Try this

Replace "filePath" to match your folder path

Macro Kingdoms
Code:
Copy      Help
Dir d
ARRAY(str) aDir aPic
str tempDir tempPic filePath="$my pictures$\Kingdoms\"

foreach(d _s.from(filePath "*") FE_Dir 2)
,str path=d.FileName
,if(find(path ".jpg" 0 1)>-1) aPic[]=path
,else aDir[]=path

for int'i 0 aDir.len
,tempDir=aDir[i]
,tempDir.findreplace(" " "" 8)
,for int'j 0 aPic.len
,,tempPic=aPic[j].getfilename
,,tempPic.findreplace(" " "" 8)
,,if (StrCompare(tempPic tempDir 1)=0)
,,,str onePic.from(filePath aPic[j] ".jpg")
,,,str oneDir.from(filePath aDir[i])
,,,ren- onePic oneDir
#8
I was surprised, thank you very much. Big Grin :o :lol:


Forum Jump:


Users browsing this thread: 1 Guest(s)