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 8712281
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T05:04:42+00:00 2026-06-13T05:04:42+00:00

I wrote a small script that copies, then removes and then creates a symbolic

  • 0

I wrote a small script that copies, then removes and then creates a symbolic link from where the file was moved to it’s new location.
To easly do it for multiple times I used variables, but when a file has spaces in it, I’m getting some errors, even though I’m using ‘\’ in front of every space.
Here is my code:

dest=~/Videos-win/file\ name\ with\ spaces
src=~/Downloads/file\ name\ with\ spaces

echo $dest ;
cp -r $src $dest ;
rm -R $src ;
ln -s $dest $src ;
echo 'done'

I also tried with ‘\\’ (adding ‘\ ‘ to the var). also got me some errors.

Anyone knows what am I doing wrong? tnx

  • 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-13T05:04:43+00:00Added an answer on June 13, 2026 at 5:04 am

    Try this :

    dest="$HOME/Videos-win/file name with spaces"
    src="$HOME/Downloads/file name with spaces"
    
    echo "$dest"
    cp -r "$src" "$dest"
    rm -R "$src"
    ln -s "$dest" "$src"
    echo 'done'
    

    Please, USE MORE QUOTES! They are vital. Also, learn the difference between ' and " and `. See http://mywiki.wooledge.org/Quotes and http://wiki.bash-hackers.org/syntax/words

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

Sidebar

Related Questions

So I've wrote a small script to download pictures from a website. It goes
I wrote a small program, that creates files at an interval of 1 minute.
I wrote a small script which copies the billing address to the delivery address
I wrote a small script, which parses a XML-file, deletes some redundant elements and
I noticed the other day that a new script I wrote for php 5
So I wrote a small python script that allows me to specify some folder
I wrote a small-ish Python script that handles nightly conversions and archiving of audio
i wrote a small FQL script that returns the latest wallposts of my fanpage.
I wrote a small ruby script that generates an array like the one below:
Backup Script Please check the link above, I wrote this small script in python.

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.