How to place zipped files back in their original folders
Q: Is there a way to place the zipped files back in their original folders? I just want to zip the folders and leave them in their original location. I need to ONLY zip the “ART” folder inside this subfolder. Maybe we could schedule a Remote support session to help me work through it?
A: This should be possible using our scripting option.
- As Source we need to add a Windows folder with the following setup:
- Add %VSA as Source
- %VSA is a parameter (Var String A) which will contain data from the script that we’ll add in a next step
- Open our Pascal Script option:
- Enable and add the following ‘On Rule Begin’ Pascal Script
- Do not forget to adjust the ctSourceDir Const
- The ctSoureDir is the directory you want us to scan for ‘Art’ subfolders.
var iList: Integer; tmpList1, tmpList2: TStringList; Const ctSourceDir = 'C:\Test\In_ZIP'; Begin psExitCode:= 0; psVSA := ''; // ... add your code here tmpList1 := TStringList.Create; tmpList2 := TStringList.Create; Try tmpList2.StrictDelimiter := True; tmpList2.QuoteChar := #0; tmpList2.Delimiter := ';'; psListPaths(ctSourceDir, '*.*', 1, tmpList1); For iList := 0 To (tmpList1.Count - 1) Do Begin psListPaths(tmpList1.Strings[iList], 'Art', 1, tmpList2); End; // Check If tmpList2.Count > 1 Then Begin psExitCode := 1; psVSA := tmpList2.DelimitedText; // psLogWriteStr('Source folders: ' + psVSA); End; Finally tmpList1.Free; tmpList2.Free; End; End.
- Folder structure of our ctSourceDir ( C:\Test\In_ZIP );
- Filename Exclude Filter Setup (optional):
- We added *.zip as Filename Exclude Filter since we are placing the created zip file back in the directory which we are scanning for files, just to sure.
- Directory Filter Setup:
- Function Setup:
- ZIP as Destination Setup:
- Zip as Destination Setup:
- Zip all files found during scan to a single destination file
- Adjust zip filename to Zipped-Art
- Select ‘Add to archive if exists, otherwise create new archive’
- Add .zip as extension
- Result after Rule is triggered:
If you need any help with this “place zipped files back” question, please let us know.
Best Regards,
Limagito Team
#zip #managedfiletransfer #filetransfer #filemanagement