Skip to content

remove from windows dir ? #5

Open

Description

@irom77

How do I put absolute Windows path ?

Activity

  1. binarykitchen commented on Jul 15, 2015

    @binarykitchen
    Owner

    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.

  2. irom77 commented on Jul 16, 2015

    @irom77
    Author

    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

  3. irom77 commented on Jul 16, 2015

    @irom77
    Author

    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

  4. binarykitchen commented on Jul 17, 2015

    @binarykitchen
    Owner

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

  5. irom77 commented on Jul 17, 2015

    @irom77
    Author

    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>
    
  6. binarykitchen commented on Jul 20, 2015

    @binarykitchen
    Owner

    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)

  7. irom77 commented on Jul 30, 2015

    @irom77
    Author

    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>

  8. binarykitchen commented on Jul 31, 2015

    @binarykitchen
    Owner

    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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions