mIRC Homepage
Posted By: colt45 Detect new file or folder - 04/07/20 03:19 PM
Hi, I'm hoping to write something that alert me for any new files/folders uploaded by someone onto my dropbox.

I plan to run this timer every 5 mins on mIRC startup

Code
alias FDD {
var %FDpath C:\Users\colt\Dropbox
  echo @NEW New Directory(s) Detected : $finddir(%FDpath,*.*,0,0,echo $1-)
  echo @NEW New File(s) Detected : $findfile(%FDpath,*.*,0,0,echo $1-)
}
The result isn't how I was hoping for, all I see the output was
Code
C:\Users\colt\Dropbox\Test
C:\Users\colt\Dropbox\test1.txt
C:\Users\colt\Dropbox\test2.txt
C:\Users\colt\Dropbox\test3.txt
but what I see in @NEW
Code
New Directory(s) Detected : 1
New File(s) Detected : 3
How can I get this to display them into @NEW window? So that it would show like this ...
Code
New Directory Detected : C:\Users\colt\Dropbox\Test
New File(s) Detected : C:\Users\colt\Dropbox\test1.txt
New File(s) Detected : C:\Users\colt\Dropbox\test2.txt
New File(s) Detected : C:\Users\colt\Dropbox\test3.txt


Hope someone can help me,

Thanks
Posted By: SLiprockS Re: Detect new file or folder - 04/07/20 05:07 PM
Hi, you can try this out which may serve your purpose

Quote
alias FDD {
var %FDpath C:\Users\colt\Dropbox
/window @NEW | echo @NEW New Directory(s) Detected : $finddir(%FDpath,*.*,0,)
/window @NEW | echo @NEW New File(s) Detected : $findfile(%FDpath,*,0,1)
}


Thanks
Posted By: maroon Re: Detect new file or folder - 04/07/20 06:27 PM
You've got 2 echoes going on, you're sending the count of matching folders to @new but the echo of the individual matches are going to the status window. If you want both to go to @new, then you need to send both echoes there. If you only want the matches going there, then do something like

//noop $finddir(%fdpath,*,0,1,echo @NEW New Directory(s) Detected : $1-)

Note that the depth of 0 you used behaves like depth of 1, so you're not seeing subdirs unless you either change depth to something big like 99 or just drop that 4th parm. Also note that if you're trying to copy/move folders or filenames someone creates having doublespaces would require special handling, such as addressing them using $shortfn.
Posted By: colt45 Re: Detect new file or folder - 05/07/20 12:09 PM
Originally Posted by SLiprockS
Hi, you can try this out which may serve your purpose

Quote
alias FDD {
var %FDpath C:\Users\colt\Dropbox
/window @NEW | echo @NEW New Directory(s) Detected : $finddir(%FDpath,*.*,0,)
/window @NEW | echo @NEW New File(s) Detected : $findfile(%FDpath,*,0,1)
}


Thanks


Thanks for getting back to me, however - it's not how I want to see .. I see this when I ran that.
Code
New Directory(s) Detected : 1
New File(s) Detected : 3

and nothing else, I just want to display the new filename and new directory .. not numbers smile
Preferably want to announce into a channel where I and my other friend can view of any new items coming in.
Posted By: colt45 Re: Detect new file or folder - 05/07/20 12:13 PM
Originally Posted by maroon
You've got 2 echoes going on, you're sending the count of matching folders to @new but the echo of the individual matches are going to the status window. If you want both to go to @new, then you need to send both echoes there. If you only want the matches going there, then do something like

//noop $finddir(%fdpath,*,0,1,echo @NEW New Directory(s) Detected : $1-)

Note that the depth of 0 you used behaves like depth of 1, so you're not seeing subdirs unless you either change depth to something big like 99 or just drop that 4th parm. Also note that if you're trying to copy/move folders or filenames someone creates having doublespaces would require special handling, such as addressing them using $shortfn.


That's the one! laugh
Works, now time for me to improvise!
Thanks smile
© mIRC Discussion Forums