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

  • Home
  • SEARCH
  • 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 5942189
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T16:13:01+00:00 2026-05-22T16:13:01+00:00

I am looking to write a Linux shell script in order to perform a

  • 0

I am looking to write a Linux shell script in order to perform a backup and restore of all of the source code in my project folder (.c, .cpp, .java, etc)

My script deletes all of these source code files and I want to be able to easily restore the files as well if need be.

Here is what I am doing now:

#copy the entire directory to a backup folder
cp -r $CLEANUP_PATH $BACKUP_PATH

#delete the project and copy from backup to restore source code
rm -rf $CLEANUP_PATH
cp -r $BACKUP_PATH $CLEANUP_PATH

The project is around 600MB, so it takes a long time when I perform these actions.

How would I be able to restore only the source code (rather than the entire directory) from a backup and ensure that each file is restored to the specific directories that each file belongs in?

  • 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-05-22T16:13:02+00:00Added an answer on May 22, 2026 at 4:13 pm

    Consider using tar: it remembers everything about the files, including paths, permissions, and dates. If you source code is inside a few directories, you can extract those directiories by name from the tar file.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am looking to write some C# code for linux/windows/mac/any other platform, and am
I'm looking to write a small web service to run on a small Linux
Looking to write an SNMP and Netflow tool for Linux\BSD and seeking advice on
I am looking for a (correct) way to read and write to a linux
I'm desperately looking for some C sample source code that describes how to implement
Ok, I need to write a code that calls a script, and if the
Iam looking to write a C# application to alert the user when he gets
I'm looking to write a html sanitiser, and obviously to test/prove that it works
I'm looking to write a small proxy server for kicks and giggles. Apart from
I am looking to write a function like ref String TestIt( int index )

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.