Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Join us in Toronto Sept 9th for Qlik's AI Reality Tour! Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

delete files more than 45 days (example) old?

So, I figure once I get a list of these files, I can just use tFileDelete to delete them. (I assume I would feed into tFileList and then make a connection to tFileDelete, like in the pic, but I'm not positive.)

What I don't know is how to read a directory and get a list of the (zip) files that are older that today minus x # of days.
0683p000009MC31.jpg
Labels (2)
21 Replies
Anonymous
Not applicable
Author

hi guys how are you.
i am Fabricio and i am from Brazil.
i am working in develop process for File delete Old.
figure the process, i am student of science of Computing.
In tMap:
Convert TimeStamp Unix for Date: new java.util.Date((long)(row1.mtime/1000*1000))

0683p000009MCFP.png
Anonymous
Not applicable
Author

This is how I do it (I call it pruning).
I create some Variables in a tMap and then use Var.prune to determine if the file path should be emitted.
// Returns a long based on the oldest date you want to keep
((java.util.Date) globalMap.get("OldestDate")).getTime()
// Returns the number of milliseconds that the file (based on tFileProperties mtime) has passed it's pruning time.
Var.oldestMTime - archiveAllDirectories.mtime
// Returns true or false
// This value determines if the file path is output from a tMap.
Var.millisecondsPastPruning > 0 ? true : false 
This image shows a SubJob that collects the file names that need pruning. You can then iterate this to delete.
0683p000009MCIX.png