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

How to add a folder on top of subfolders?

I have a folder in my local computer called "Total". There is a subfolder "2018-10" under "Total" and there are a few subdirectories under "2018-10":

/Total/2018-10/Subfolder_A/  files

/Total/2018-10/Subfolder_B/  files

/Total/2018-10/Subfolder_C/  files

 

I need to add a folder "2018" on top of "2018-10" so the directories would be look like this:

/Total/2018/2018-10/Subfolder_A/  files

/Total/2018/2018-10/Subfolder_B/  files

/Total/2018/2018-10/Subfolder_C/  files

 

Can anybody give some advice? Thank you!

Labels (2)
1 Solution

Accepted Solutions
Anonymous
Not applicable
Author

Hi,

 

    Another idea is to archive the directory with its sub folders using tfilearchive functionality and copy the archive file to the new area. Once the archive file is present in the new directory, you can use tfileunarchive component to unzip the files.

 

     The advantage of this method is that you need to do less amount of data transfer since its a zip file. So this will help you to complete the task if the data volume is high.

 

    Please don't forget to select the sub directories and all files options in tfilearchive component. Similarly in tfileunarchive component, select extract file path option.

 

      Below are the links for both the components.

 

https://help.talend.com/reader/WWQ40R_iTE5~~9VkUQrjgQ/~V42EBQClKxKQghNvzHF1g

 

https://help.talend.com/reader/WWQ40R_iTE5~~9VkUQrjgQ/7Bj99i9HHD~wcAItQuK9Zw

 

Could you please mark the topic as resolved so that it will help others in our Talend community?

 

Warm Regards,

 

Nikhil Thampi

View solution in original post

2 Replies
Anonymous
Not applicable
Author

Here is my current solution (with 3 steps):

0683p000009LzbO.pngl

1. Step 1: tCreateTemporaryFile

    Directory: ((String)globalMap.get("tFileList_8_CURRENT_FILEDIRECTORY"))+"/"+((String)globalMap.get("FiscalYear"))

   Create a directory "2018" under "Total", so there will be two subfolders under "Total" now:

   /Total/2018/

  /Total/2018-10/

 

2. Step 2: tFileCopy

 check "Copy a directory"

Source directory: ((String)globalMap.get("tFileList_8_CURRENT_FILEDIRECTORY"))+"/"+((String)globalMap.get("FiscalPeriod"))

Destination directory:((String)globalMap.get("tFileList_8_CURRENT_FILEDIRECTORY"))+"/"+((String)globalMap.get("FiscalYear"))

 

3. Step 3: tFileDelete

    Delete the subfolder "2018-10" under "Total"

  File or Directory to delete: ((String)globalMap.get("tFileList_8_CURRENT_FILEDIRECTORY"))+"/"+((String)globalMap.get("FiscalPeriod"))

 

Please let me know if you have a better way to do it. Thanks!

 

TM

Anonymous
Not applicable
Author

Hi,

 

    Another idea is to archive the directory with its sub folders using tfilearchive functionality and copy the archive file to the new area. Once the archive file is present in the new directory, you can use tfileunarchive component to unzip the files.

 

     The advantage of this method is that you need to do less amount of data transfer since its a zip file. So this will help you to complete the task if the data volume is high.

 

    Please don't forget to select the sub directories and all files options in tfilearchive component. Similarly in tfileunarchive component, select extract file path option.

 

      Below are the links for both the components.

 

https://help.talend.com/reader/WWQ40R_iTE5~~9VkUQrjgQ/~V42EBQClKxKQghNvzHF1g

 

https://help.talend.com/reader/WWQ40R_iTE5~~9VkUQrjgQ/7Bj99i9HHD~wcAItQuK9Zw

 

Could you please mark the topic as resolved so that it will help others in our Talend community?

 

Warm Regards,

 

Nikhil Thampi