Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8928741
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T08:31:00+00:00 2026-06-15T08:31:00+00:00

Problem statement: I want to unzip files from a folder like /home/a/zip_input where there

  • 0

Problem statement: I want to unzip files from a folder like /home/a/zip_input where there will be 2 zip files like:
/home/a/zip_input
a_EOD-20121129.zip
b_EOD-20121129.zip

Also there will be 1 corresponding .done file for each each zip(basically once the zip is completely copied a .done file is created)
like:
a_EOD-20121129.zip.done
b_EOD-20121129.zip.done

I am trying to write a script to unzip the files which are having a corresponding .done file, and move the file to a location /home/b/file_input. After the file is moved compeltely I want to create a file with .done ext. For eample:
each zip is having one xml file like a_EOD-20121129.xml/b_EOD-20121129.xml

so the output folder will have something like:

a_EOD-20121129.xml
a_EOD-20121129.xml.done
b_EOD-20121129.xml
b_EOD-20121129.xml.done

What I have tried Till now:

for file in $(find . -name "*.zip" -type f)
do
    unzip $file -d /home/b/file_input
    rm $file    
done

Which unzips a.zip/b.zip and creates the xml files.

Issue I am facing –

  1. How to make the condition in script that only picks files having a corresponding .done file?

  2. How to create a corresponding .done file after the file is unzipped and moved.(have to take the file name and create a file with same name appending .done)?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T08:31:01+00:00Added an answer on June 15, 2026 at 8:31 am

    You can try the following script(Not tested):

    for file in $(find . -name "*.zip" -type f)
        do
          if [ -f $file".done" ];    then         #test if there is a done file for that zip
              unzip $file -d /home/b/file_input
              for filezip in `unzip -l $file | awk '/.xml$/{print $NF}'`; do  #creates the .done files for each file inside the zip
                 touch /home/b/file_input/$filezip".done"
              done
              rm $file    
          fi
        done
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Problem statement I want to access a server without asking me the password (will
I have an big problem with an SQL Statement in Oracle. I want to
Problem statement:- I want to create 50 instances of a vector(1 Dimension) which contains
My problem statement is : I want to write design file management (add, copy,
Problem Statement:- I have four shell script that I want to execute only when
Problem Statement: I would like to create an offline database to lookup prices/info on
Problem Statement is somewhat like this: Given a website, we have to classify it
My problem statement is as below. There is a concept of domain which consists
I keep coming across this problem, where i want to insert an IF statement
Problem statement: I want to upload a large binary (such as an audio clip)

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.