Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Finding All similar Files + flash in dialog + text color
#6
on the question of copy:

Macro
Code:
Copy      Help
str NewFolder="$desktop$\New Text Folder" ;; Define destination folder
if(!dir(NewFolder 1)) ;;test to see if destination folder exists
,mkdir NewFolder ;;creates folder if non-existant
Dir d
foreach(d "C:\*.txt" FE_Dir 0x4) ;;put in whatever directory you want to search
,str sPath=d.FileName(1) ;;gets current path of files
,_s=d.FileName(0) ;;gets just the filename and extention
,_s.format("%s\%s" NewFolder _s) ;;appends destination folder created above to _s
,cop+ sPath _s ;;copies from current path to destination folder. "+" appends "Copy of" to duplicates

Gintaras,
Could you give an example of turning this into one of those glorious universal functions you alway provide...
Something like this...I know this is sloppy and doesn't work, but posted it to show you what I'm talking about. I'd like to see how you would do it?
Maybe throw in some flags and optional stuff...I want to get a better grasp at working on these so I can start saving some code time...You seem to have it mastered, so I would like to get a glimpse into how you think about it.

Function MoveFileType
Code:
Copy      Help
function Directory Destination filetype

;EXAMPLE---------------------------
;MoveFileType "C:\" "$desktop$\New Text Folder" "txt"
;

str search.format("%s*%s" Directory filetype)
if(!dir(Destination 1))
,mkdir Destination
Dir d
foreach(d search FE_Dir 0x4)
,str sPath=d.FileName(1)
,_s=d.FileName(0)
,_s.format("%s\%s" Destination _s)
,cop+ sPath _s
Thanks,
Jimmy Vig


Messages In This Thread

Forum Jump:


Users browsing this thread: 4 Guest(s)