find-remove icon indicating copy to clipboard operation
find-remove copied to clipboard

remove from windows dir ?

Open irom77 opened this issue 10 years ago • 8 comments

How do I put absolute Windows path ?

irom77 avatar Jul 15 '15 17:07 irom77

Haven't tested with Windows yet. But could you try this and and paste the output here?

var result = findRemoveSync('c:\Temp', {test: true});
console.log(result);

If you use a newer Window version, probably try using this path instead: C:\Users\User Name\AppData\Local\Temp (%USERPROFILE%\AppData\Local\Temp)

Not sure here. Maybe some work is needed here to make find-remove truly Windows-compatible.

binarykitchen avatar Jul 15 '15 21:07 binarykitchen

See below. Not sure why I have to use specific directories. Isn't your code suppose to work on any give directory ?

var result = findRemoveSync('c:\Temp', {test: true});
console.log(result);
var result = findRemoveSync('C:\Users\IrekRomaniuk\AppData\Local\Temp', {test: true});
console.log(result);

and the output is :

[] [] Process finished with exit code 0

irom77 avatar Jul 16 '15 12:07 irom77

oh sorry, I just noticed it works fine on windows..what was not working is age.seconds argument, doesn't remove files

var result = findRemoveSync('c:\Temp', {age: {seconds: 3600}, extensions: '.jpg'});
console.log(result);

[] Process finished with exit code 0

irom77 avatar Jul 16 '15 12:07 irom77

@irom77 have you verified the age of these jpg files? you sure they older than one hour?

binarykitchen avatar Jul 17 '15 03:07 binarykitchen

See below

D:\ftproot\nodejs>more repstat2.js
var findRemoveSync = require('find-remove');
var result = findRemoveSync('D:\ftproot\mds_backup2', {test: true});
console.log(result);

var result = findRemoveSync('D:\ftproot\mds_backup2', {age: {seconds: 172800},extensions: '.txt'});

D:\ftproot\nodejs>node repstat2.js
[]

D:\ftproot\nodejs>dir d:\ftproot\mds_backup2\*.txt
 Volume in drive D is Data
 Volume Serial Number is 104C-9C39

 Directory of d:\ftproot\mds_backup2

04/20/2015  07:36 AM            67,402 kernel_debug-MAR-VSX-015.txt
12/16/2013  09:50 AM        11,019,808 kernel_debug2.txt
07/17/2015  11:51 AM                 0 new.txt
12/06/2014  04:00 PM            27,696 pinglist-all.txt
11/22/2014  05:45 PM            12,585 pinglist-MAL-up.txt
11/23/2014  03:49 PM            12,447 pinglist-MAL2-up.txt
11/23/2014  04:43 PM            12,487 pinglist-MAL3-up.txt
11/22/2014  05:56 PM             3,399 pinglist-WAL-down.txt
06/08/2015  02:36 PM           290,426 rep-ike.txt
06/15/2015  03:15 PM           110,825 rep-lsm.txt
09/17/2011  06:26 AM         3,506,759 tcpdumpexternal.txt
01/24/2014  11:30 PM            84,057 tunneldrop.txt
03/19/2015  11:23 AM            13,167 WAL-NEW-VSX-01.txt
03/19/2015  12:27 PM            13,167 WAL-NEW-VSX-02.txt
              14 File(s)     15,174,225 bytes
               0 Dir(s)  26,791,469,056 bytes free

D:\ftproot\nodejs>

irom77 avatar Jul 17 '15 16:07 irom77

both findRemoveSync() calls do not have the same parameters, hence you cannot compare like that.

try this:

var result = findRemoveSync('D:\ftproot\mds_backup2', {test: true, age: {seconds: 172800},extensions: '.txt'});
console.log(result);

and share the output here altogether with the contents of that directory. then we can start investigating the problem.

(be careful, if you do a findRemoveSync('D:\ftproot\mds_backup2'); it will delete everything in it)

binarykitchen avatar Jul 20 '15 02:07 binarykitchen

Here it is: D:\ftproot\nodejs>more repstat2.js var findRemoveSync = require('find-remove'); var result = findRemoveSync('D:\ftproot\mds_backup2', {test: true, age: {seconds : 172800},extensions: '.txt'}); console.log(result);

D:\ftproot\nodejs>node repstat2.js []

D:\ftproot\nodejs>dir d:\ftproot\mds_backup2*.txt Volume in drive D is Data Volume Serial Number is 104C-9C39

Directory of d:\ftproot\mds_backup2

04/20/2015 07:36 AM 67,402 kernel_debug-MAR-VSX-015.txt 12/16/2013 09:50 AM 11,019,808 kernel_debug2.txt 07/17/2015 11:51 AM 0 new.txt 07/17/2015 12:32 PM 0 new2.txt 12/06/2014 04:00 PM 27,696 pinglist-all.txt 11/22/2014 05:45 PM 12,585 pinglist-MAL-up.txt 11/23/2014 03:49 PM 12,447 pinglist-MAL2-up.txt 11/23/2014 04:43 PM 12,487 pinglist-MAL3-up.txt 11/22/2014 05:56 PM 3,399 pinglist-WAL-down.txt 06/08/2015 02:36 PM 290,426 rep-ike.txt 06/15/2015 03:15 PM 110,825 rep-lsm.txt 09/17/2011 06:26 AM 3,506,759 tcpdumpexternal.txt 01/24/2014 11:30 PM 84,057 tunneldrop.txt 03/19/2015 11:23 AM 13,167 WAL-NEW-VSX-01.txt 03/19/2015 12:27 PM 13,167 WAL-NEW-VSX-02.txt 15 File(s) 15,174,225 bytes 0 Dir(s) 26,770,358,272 bytes free

D:\ftproot\nodejs>

irom77 avatar Jul 30 '15 12:07 irom77

Right, that's evidence that something is wrong.

It's unfortunate that I have no Windows machine here to reproduce and fix this.

If I were you, I would add some console.log(...) lines in the source code and try again. For example here, inside the important isOlder() function: https://github.com/binarykitchen/find-remove/blob/master/find-remove.js#L126

add console.log('isOlder:', path, ctime, ageSeconds, now)

When the path for the file kernel_debug2.txt appears, paste the console output here.

binarykitchen avatar Jul 31 '15 04:07 binarykitchen