Select 2 most recent files for ID in a folder and then copy the files to a new folder
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Mute
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
Hello,
i need to collect the files that I am receiving in a folder called 'Replies'. I have 3 type of possible files:
AIFFBR
AIFFDB
AIFFBH
These are submission receipts. This means that I am always getting AIFFBR% file, same for AIFFDB%. Then, if AIFFDB% is fine, I am also getting a AIFFBH% as confirmation.
They are .zip and .txt extension with same naming convention. I only need the .zip files and not the .txt.
I seek for a specific file by filtering on the ID contained in the File Name and on the Creation Time column.
AIFFDB-100000000-A00001600-V00002700-00000000-AIF-20240126165425_20240129113335675.zip
AIFFBH-100000000-A00002000-V00006400-00000000-AIF-20240127042128_20240129103427384.zip
This is the file naming convention.
Most recent is based on the column of the folder 'Creation Time'
If I am filtering for V000001-0000000 and a specific date range I might get multiple files.
This depends on how many times the submission was done.
I only want to select the most recent AIFFDB and AIFFBH files for each ID I am looking for.
The result should then be copied to a new folder in the download folder.
can you please help me to build the same?
So far I am importing to Alteryx using a Directory.
Then I am filtering using 'contains' in File Name but I need to find a better way as I might need to search 40 different ID.
The challenge is how to select the 2 most recent file for ID and then copy the same to a new folder?
I tried to understand how to use a CMD but not very clear for me.
Thank for your help
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
Can you post a sample of actual file names in table format or text format in this forum?
When you said "I only want to select the most recent AIFFDB and AIFFBH files"
Is "the most recent" determined by file creation date?
Chris
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
AIFFDB-100000000-A00001600-V00002700-00000000-AIF-20240126165425_20240129113335675.zip
AIFFBH-100000000-A00002000-V00006400-00000000-AIF-20240127042128_20240129103427384.zip
This is the file naming convention.
Most recent is based on the column of the folder 'Creation Time'
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
If you have the Directory tool already, it’ll be a matter of parsing out the relevant information from the file name to give yourself a column with each “group”, sorting the data on Creation Date like @ChrisTX is mentioning, and Sampling the First N Records with N=1 and grouping by that group!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
Nice @ChrisTX !
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
I don't understand the question "how to copy the result in a new folder"
Do you want to create a new folder then save an output file in that folder?
What's an example format for the new folder name.
To create a folder: you will likely need to create and run a BAT file using the Run Command tool under the Developer category.
Chris
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
Yes exactly. I would like the files to be copied to a a new folder (no name convention needed) in the Downloads folder
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
