The dangers of robocopy and symbolic links

I was backing up a laptop to a USB drive overnight, using robocopy to copy the directory structure of C:\Users on a Win 7 Pro build. The process ran all night. By the next morning, the copy had failed due to insufficient space on the drive. The data being
backed up was only 120 GB and the drive was an empty 500 GB. According to the log, the process only made it about 20% of the way before it got caught in an endless loop of copying the C:\Users\<username>\Application Data link. I had forgot to include
the /xjd switch in the job file it seems.
Unfortunately, now I am unable to delete the "Application Data" folder as I get a "...filenames are too long for the destination folder..." error. Upon inspection, the folder appears to point to itself, creating a seemingly endless subdirectory
tree. I've tried manually deleting parts of the directory structure through cut, paste and delete operations but I gave up after 2 hrs. I then tried writing a batch script using robocopy to mirror an empty folder, hoping that would remove the "Application
Data" folder, but that too fails after a few minutes once the directory path gets too long.
I've checked online but haven't been able to find any tool which would allow me to delete the circular link that was created by robocopy. Does anyone have suggestions on how to remove this file structure besides formatting the drive?

From all the other threads I've read, I'm beginning to realize this just isn't an option with this O/S.
Thanks for the help and suggestions.
I got intrigued by this problem, then spent a couple of hours on finding a solution. You can use the batch file below to deal with your circular folder. It will deal with any folder, no matter how deep.
@echo off
goto Start
This batch file will delete circular directories that are 
created by robocopy.exe when used without the /XJ switch.
The batch file will warn you before it deletes any folder.
Pressing Ctrl+C will terminate it.
Usage: rdd "Folder Name"
22.3.2013 FNL
:Start
set msg=
if [%1] EQU [] goto Error
if [%2] NEQ [] goto Error
goto Initial
Initial checks:
- Is this an elevated command prompt?
- Does the user want to proceed?
- Does the folder exist
:Initial
set r=%random%
for /F "delims=" %%a in ('echo %1') do set Stripped='%%~a'
set msg=You must execute this batch file under elevated privileges.
dir \ 1> %SystemDrive%\%r%.txt 2>nul || goto Error
del %SystemDrive%\%r%.txt
set msg=Folder %Stripped% not found
pushd %1 2>nul || goto Error
set msg=Exiting
set /p reply=About to delete the folder %1. Go ahead? (Y/N) 
if /i not "%reply%"=="Y" goto Error
set Level=0
for /F %%a in ('dir /b \RDD_Folder* 2^>nul') do rd \%%a
set Args=WScript.Arguments
echo WScript.Echo Left(%Args%(0), InStrRev(%Args%(0), "\")-1) >"%temp%\rdd.vbs"
goto Loop1
Create a number of junctions to various points
inside the circular directory tree.
Prerequisite: mklink (exists under Windows 7)
:Loop1
for /F "delims=" %%a in ('dir /b /s 2^>nul') do set FullPath=%%a
if "%FullPath:~200,4%" EQU "" (echo. & goto Loop2)
for /F "delims=" %%a in ('cscript.exe //nologo "%temp%\rdd.vbs" "%FullPath%"') do cd "%%a"
set msg=Unable to create junction.
set /a Level=%Level%+1
echo Creating junction \RDD_Folder%Level%
mklink /d \RDD_Folder%Level% "%CD%" > nul|| (popd & goto Error)
cd "\RDD_Folder%Level%"
goto Loop1
Delete the circular folders, working from
the inside to the outside, then delete the
symbolic links.
:Loop2
for /f "delims=" %%a in ('dir /b "\RDD_Folder%Level%"') do set ToDelete="\RDD_Folder%Level%\%%a"
echo Deleting %ToDelete%
pause
rd /s /q %ToDelete%
rd \RDD_Folder%Level%
set /a Level=%Level%-1
if %Level% NEQ 0 (
  cd \RDD_Folder%Level%
  goto Loop2
popd
echo Deleting %1
pause
rd /s /q %1
goto :eof
Error exit
:Error
echo.
if "%msg%"=="" set msg=Usage:  rdd  "FolderName"
echo %msg%

Similar Messages

  • Issue with stat() and symbolic links

    Has anyone experienced the following issue with stat() ?
    #include <stdio.h>
    #include <string.h>
    #include <sys/types.h>
    #include <sys/stat.h>
    #include <unistd.h>
    int main( int argc, char **argv )
    struct stat buf;
    if( argc < 2 )
    return 0;
    char *link = strdup( argv[1] );
    if( stat( link, &buf ) == -1 ) {
    puts( "Error" );
    return 1;
    if( ( S_IFLNK & buf.st_mode ) == S_IFLNK )
    puts( "Is link" );
    else
    puts( "Not link" );
    return 0;
    If you compile and run the above code (or similar code), you would expect it to report that the given argument is a symbolic link when indeed the argument is a symbolic link; though, instead of the expected happening, the following happens as shown below:
    $ gcc -o islink islink.c
    $ ln -s /tmp link
    $ ./islink link
    Not link
    $
    Is anyone else experiencing this? My filesystem is ext4. The same error happens when using the S_ISLNK() macro.

    man 3p lstat
    DESCRIPTION
           The lstat() function shall be equivalent to stat(),  except  when  path
           refers  to  a symbolic link. In that case lstat() shall return informa‐
           tion about the link, while stat() shall return  information  about  the
           file the link references.

  • Does Java/JVm have a way to ditinguish between real files and Symbolic link

    Hello guys,
    I am using java.io.File.listFiles to list files in a directory. I have a symbolic link in the directory. the "listFiles" listing symbolic file contents too. As the real directory Symbolic link pointing is huge, the application taking too much time to load. is it a normal behaviour? are there any work arounds?

    Short version: If getCannonicalPath() and getAbsolutePath() return different values, then the file you look at is a symlink.
    [longer version|http://www.idiom.com/~zilla/Xfiles/javasymlinks.html]

  • Unable to catch the exceptions caused by '|', '"' and '~' symbol in the URL

    I have a VB.net website with .Net framework version 1.1.
    I am able to catch all the exceptions and redirect to Custom error screen.
    However if I enter the invalid characters in URL specifically  '|', '"' and '~' it throws "ArgumentException" with message as "?" and not able to redirect this to Custom error screen.
    All other invalid characters and symbols are being handled properly. Custom error screen is set in WEB.config and it is working for all the exceptions.
    Please help me find a way to catch and redirect this exception to Custom error screen.

    Hello Mr. Monkeyboy,
    One of the security solutions ran a security test by entering the wrong characters in the URL (Few more cases) and there by finding if the site redirects to Custom webpage in case of errors and exceptions or not.
    Our site is redirecting to Custom error page for all the errors and exceptions except when entered '|','"' or '`' in the url.
    Example: If I enter: https://www.somesite.com/NotExists.aspx this get redirected to Custom error screen.
    However If I enter https:////www.somesite.com/NotExi|sts.aspx this goes to Server Error in "/somesite" page.
    Please note, both the URL is invalid, however one redirects to Custom error where another doesn't.
    Thanks for letting me know the lack of clarity in the initial question, hope I made it clear.
    I still don't understand the issue. And you should probably be posting the question in one of the ASP.Net forums which I provided a link to in my original post.
    You say you enter a URL in your website. But you make no mention of how that is done. Therefore even if you post a question in one of the ASP.Net forums you will need to explain what you mean by entering a URL in your Website.
    For example. "We have a website. A user can browse to the website with a WebBrowser. Then in a textbox on the website they can enter a URL (for whatever reason your website would allow a user browsing your website with a webbrowser to want to enter
    some URL for some reason into a textbox at your website) and select a button (to do who knows what) and we need to validate the URL does not contain invalid characters."
    Maybe these links can help or not.
    Validator.Url Method
    PathIsURL function
    Pinvoke.Net - pathisurl (shlwapi)
    Uri.TryCreate Method
    I suppose you could even use Regex to validate a URL based on Regex patterns that you should be able to find on the net for doing so with Visual Basic. But I would suppose you would want to provide whoever is placing invalid URL's on the website with the
    result displaying the invalid URL and which characters within it are invalid maybe.
    I suspect you could even try to validate a URL with a DNS by finding out if it exists or not.
    La vida loca

  • Networked Drives and Symbolic Links in Mavericks

    So I have tried this a few times on my own... and I ended up deleteing all my contect with sudo in terminal.....  I have everything restored now... but before I proceed, i thought I would get some help from those that know alot more...
    Here is the scenario..  I have a MBP Late 2013 with mavericks installed..  I have a Networked drive at smb://192.168.1.1/  that is mounted and and accessable through finder no problem, and I have it set to reconnect at login so its always there....  there is no permissions for the networked drive its accessable to everyone...  I want to take my itunes music and put it on the networked drive at smb://192.168.1.1/Music and have itunes access it from there like it was on the local drive....  so I started reading up on symbolic links
    I have had no luck with ln -s in terminal, i keep getting told the directory doesnt exist... this is the exact line i have been triying  [ln -s smb://192.168.1.1/Music ~/Music/iTunes/iTunes Media/Music]  i thought it may have been a permission issue hence my ussage of sudo... but because of my ignorance I just ended up deleting everything..... what am i missing or doing wrong...  someone please help!
    Anthony

    Just for some clarification...
    A simple saying that someone told me ages ago...   "root is God"
    When you use the sudo command you are doing the command as root.  The "rm" command means remove,  the "-r" means that you want the command to be done recursively so it will do the same command in any nested folders, and the "f' means to force the command..  even if it has any errors or is a file that root knows that you shouldnt do a command on..
    So basically you told god to remove everything in your music folder, no matter how deep its nested, even if doing so would be immoral and against gods better judgement.

  • How can I change the text for 'Return' and 'Back' links

    Hi everybody,
    How can I change text of standard links 'Return' and 'Back' that appear at the report bottom when user drills down?
    I need to change it in Hebrew interface.
    Thanks in advance,
    Alex

    You have to Customize the viewmessages.xml file. The original file path for English Language is
    oraclebi\web\msgdb\l_en\messages\viewmessages.xml.
    and The entries for back and return are
    <WebMessage name="kmsgEVCLinkBack"><HTML>Back</HTML></WebMessage>
    <WebMessage name="kmsgEVCLinkReturn"><HTML>Return</HTML></WebMessage>
    For more details, about language cusotmization read oracle documentation, page no 197.
    http://download.oracle.com/docs/cd/E10415_01/doc/bi.1013/b31766.pdf
    - Madan

  • How to turn the elements auto analyzer and dynamic link manager off?

    While I was installign the trial version of photoshop cc, a question popped up asking me to turn elements auto analyzer and dynamic link manager off, but I couldn't find them. Please help me

    Terminate the processes in Task Manager/ Activity Monitor.
    Mylenium

  • In IWeb '09 Sidebar what do the different page colors and symbols refer to?

    Under my two websites I've designed in IWeb I see each of the different tabs/pages are represented by different symbols. For example my first site is one page long and its symbol is a red page with a key on it and I think a cloud. Can you tell me what each of these represent?
    In my other website with multiple pages they are all blue. One tab has a Q on it (possibly for Quicktime?) and another page has a person on it. Can you tell me what these mean?
    Is there a place that provides a key of all these symbols?
    Thank you,
    Jamie

    It the site folder has a cloud on it that means it's being published to a MobileMe account. It the site folder is plain then it's being published to somewhere else, either a commercial server or a folder on your HD.
    The page with a Q on it is a movie layout page. The only other page with a symbol that I've come across is the blog page, and "a" on the page icon.
    If a page is red it means there have been changes made that haven't been added to the site. A blue item means the published item is up to date.
    OT

  • [Partially Solved] Error with bsdtar and symbolic links

    I'm trying to install a package (asymptote) from AUR but am running into an odd error.  During the extract phase I get errors like
    asymptote-1.70/base/asy-keywords.el: Can't update time for asymptote-1.70/base/asy-keywords.el: Function not implemented
    bsdtar: Error exit delayed from previous errors.
    I found a post that may help: http://bbs.archlinux.org/viewtopic.php?id=50750.  Do I really have to do this?
    By the way, I too am running on a Linode (Xen virtualization).
    Thanks,
    Luis
    Last edited by banbh (2009-05-24 00:22:13)

    I have not got to the bottom of my problems with bsdtar and symlinks.  I suspect it must have something to do with either my configuration (derived from the Arch image provided by Linode) or running under virtualisation.
    However, others might find my work-around useful, so I document it below.
    I downloaded asymptote from AUR using wget ("wget http://aur.archlinux.org/packages/asymptote/asymptote.tar.gz"), unpacked it, then patched the PKGBUILD
    $ diff -u PKGBUILD.orig PKGBUILD
    --- PKGBUILD.orig 2009-05-23 17:58:47.000000000 -0400
    +++ PKGBUILD 2009-05-23 18:00:49.000000000 -0400
    @@ -11,9 +11,12 @@
    'used if present at compile time: freeglut, gsl, fftw')
    source=(http://downloads.sourceforge.net/sourceforge/asymptote/$pkgname-$pkgver.src.tgz)
    md5sums=('1ded335bc63b662a6eb920a4c065706c')
    +noextract=($pkgname-$pkgver.src.tgz)
    build() {
    - cd $srcdir/$pkgname-$pkgver
    + cd $srcdir
    + tar xzf $pkgname-$pkgver.src.tgz
    + cd $pkgname-$pkgver
    ./configure --enable-gc=/usr --prefix=/usr \
    --with-latex=/usr/share/texmf/tex/latex || return 1
    make asy || return 1
    After that I simply did a "makepkg" followed by "sudo pacman -U asymptote-1.73-1-i686.pkg.tar.gz"

  • The keyboard number keys and symbols above them will not work. I nothing at all except a space or they last letter key used, but works fine in other applications such as MS Word. The number pad works just fine. Any one have any thoughts on this.

    I had to do a reinstall and upgrade to Windows 7, so I may have missed something. Running a 64bit OS. Problem only seems to be in the browsers.

    You may have '''Switched ON Caret Browsing'''. press '''F7 (on Mac: fn + F7)''' to toggle '''Caret Browsing ON/OFF'''
    * click '''Firefox''' button and click '''Options''' -> Advanced -> General -> remove Checkmark from '''Always use the cursor keys to navigate within pages'''
    * http://kb.mozillazine.org/Scrolling_with_arrow_keys_no_longer_works
    * http://kb.mozillazine.org/Accessibility_features_of_Firefox
    Check and tell if its working.

  • How can I stop the nuisance video ads and add links being generatesd, since getting the latest Firefox update installed, I HATE them getting in the way?

    Little video ads appear at random times on the lower right of my screen. Also, in some sites a few "key words" are being converted into hyperlinks to unwanted advertisers. In some instances, we also see this appearing on the East Arkansas Community "Campus Connect" site, promoting other online educational organizations that are in potential competition with our institution. This is unacceptable.

    hello angrommet, this sounds like a problem caused by adware active on your pc. please go to ''firefox > addons > extensions'' & remove any suspicious entries (toolbars, things that you have not installed intentionally, don't know what purpose they serve, etc). also go to the windows control panel / programs and remove all toolbars or potentially unwanted software from there and run a full scan of your system with the security software that you have in place and different other tools like the [http://www.malwarebytes.org/products/malwarebytes_free free version of malwarebytes] & [http://www.bleepingcomputer.com/download/adwcleaner/ adwcleaner].
    [[Remove a toolbar that has taken over your Firefox search or home page]]
    [[Troubleshoot Firefox issues caused by malware]]

  • Asigning Reports, specific tables and Url links to the Role

    Hello Gurus,
    could you please tell me the procedure of asigning Reports, specific tables and Url links in the role.actually i know the process of assigning T-Codes to the role but i dont know the procedure for reports and url links and tables...
    i hope u people will respond positively.
    Cheers.......
    srinivas.korva

    Hi Srinivas,
    "i want to add only one particular table not all tables", you can do this using a Custom Transaction Code, the following are the steps to do it:
    1) goto se93, give a unique name, say zxxx
    2)Enter SE16 into the transaction field and select the flag the ‘skip initial screen’ field:
    3)On the lower portion of the screen, enter the following information:
    Name of screen field: DATABROWSE-TABLENAME
    Value: Enter the name of the table you want to browse with
    4)save it.
    5) Now add the transaction zxxx in th role, and assign it to the user.
    With this, when user executes the transaction, he/she will be able to see only the perticular table you added.
    "in PFCG what is the use of Exper mode for profile generation. what is the difference between general profile generation and expert mode profile generation".
    Expert mode has 3 options:
    1) Delete and recreate profile and authorizations---This will completely delete the old profile and add only  the new once.
    2) Edit old status----It will edit the old values
    3) Read old status and merge with new data----This will add the new values aithout actually disturbing the old ones.
    Hope it helps.
    Please award points if it is useful.
    Thanks & Regards,
    Santosh

  • [SOLVED] Inquiry about the {{Note | }} environment and url links

    Recently I've added some notes to the wiki and tend to like to link to sources where possible. I've tried to do this with forum posts, but because of the url syntax:
    https://bbs.archlinux.org/viewtopic.php?id=#####
    the note environment doesn't like it and results in this:
    {{{1}}}
    Specifically, I've tracked it down to the equals sign ("="). Could anyone chime in on:
    - the preferred method of linking to an external url inside of a note (or if that is discouraged)
    - if I've overlooked some syntax that would allow this for the url format above (like putting it in quotations or something like that?)
    - if it's possible to change why the "=" in a url will prevent such linking
    It's a bummer... I love linking to the forums from the wiki because a lot of the answers originate here during problem solving. I don't have to use the note environment, but I find lately that some of the main article will be quasi correct but potentially misunderstood and so I've create a note and linked here. Since I can't directly link, I've been adding the forum post urls in the "Additional Resources" section at the bottom of articles and just linking to that via the [[wikiURL#Additioanal_Resources]] syntax.
    To be able to directly input a url would simply things, I think.
    Last edited by jwhendy (2011-03-11 01:12:55)

    See Help:Template
    Note: If you use the equal sign ( = ) inside a template with numbered parameters, MediaWiki will break the template's output. You need to enclose the equal sign (or the entire block of text) in <nowiki> tags like so:
    {{Codeline|<nowiki>variable = value</nowiki>}}
    Alternatively, treat the parameter number as a named parameter, as in:
    {{Codeline|1=variable = value}}
    This is a technical limitation that you should keep in mind while using templates.

  • Maintaining Multiple Arch Installs, Symbolic Links, BTRFS

    Hi again.
    A quick update on my previous post (https://bbs.archlinux.org/viewtopic.php?id=164627). The GRUB problem I was having seems to have stopped. I got a very useful recommendation regarding pacman and XBMC still hasn't been fixed, but is fully usable with the workaround I am using and have just gotten used to it so it's not so much of an issue now. I think now that it should be marked as solved but how do I do that? Was looking around but guess I'm just missing it.
    Anyway now I have a few more issues, or more just questions I guess that I would like help on. Recently I found an old laptop of mine and so to learn more about the Arch system I decided to try and install Arch. Now this laptop is around 5-6 years old and I haven't been able to get WiFi working fully for around 3 years and eventually upgraded 2 years ago to my current laptop. The WiFi was always 'soft-locked' until after about 4-5 restarts (in windows it was fine, but any Linux Distribution post Ubuntu 10.10 had the same issue). The issues still remains in other distributions even after "rfkill all". In Arch ever since running that command (the first boot from install media the issue occurred) this laptops WiFi has been brilliant. I also installed XFCE4 desktop for speed of set up. Now I'm looking to give my laptop to my younger brother before he heads of to University in September until he can afford a new one (or he breaks this one - somehow his laptops never last), as this old one now runs better than it ever did on Windows Vista. My girlfriend is also looking for me to install Linux again on her laptop (we used WUBI in the past) but a full install since her Windows Vista laptop is near unusable in Windows. So far I have got hamachi set up between my new and old laptop, this gives static IP addresses and will allow me to SSH into the laptop for upgrades every so often. I'm planning to do the same for my girlfriends laptop. Would I be stupid to do this via Arch? I've heard it breaks often and I don't want to have to be doing fixes for other peoples laptops as I won't have the time to do so. I guess the reason I want to use Arch is both laptops are quite old and Arch has breathed new life into my old one.
    Secondly I have symbolic links set up in my "Music" and "Video" folders in my home directory to their counterparts in my Windows partition. However my music player "Clementine" doesn't find every album in the music folder. Does symbolic links have "flaws" like this or is it more likely to be my music player behaving badly with symbolic links? I would try another music player but I can't seem to find one which plays FLAC files with external / embedded .cue files so can't really test this out. I can of course link directly to the location but I thought I would ask, just to learn more I guess.
    Now when I installed Arch using BTRFS file system I didn't know that I had to mount using compression immediately, I thought I could add it to the fstab at a later point - obviously not. Now I found a command which will defragment my drive and supposedly compress everything. However this command doesn't make any sense to me and I don't want to just run it without knowing what it does. Could anyone other me any insight into this please? Also does defragmentation after the fstab mount options have been added cause the compression?
    "find -xdev -type f -exec btrfs fi defrag '{}' \;"
    or I also found
    "btrfs filesystem defragment ~/stuff"
    Thanks for any help, I understand this post is quite long so I really appreciate it.
    Last edited by BradPJ (2013-06-13 10:19:47)

    Ah right thanks. I thought as much which is why I asked before I did so, I'll find another distribution. Just where I've been running Arch for a few weeks now and haven't had to do any maintenance at all really, but weren't too sure what I'd be in for in the long-run. I mean to be fair I was always planning on another distribution but as I was playing around at first on the old laptop I ended up with my current way to SSH in and just wondered if it would be viable to do it this way.
    I knew it would be a driver issue at the core of my problem, just weren't too sure if it something else could of been affecting it. Guess I'll try and find another distribution which runs near as new software to Arch as possible as it seems the issue has been fixed in newer versions of the kernel and drivers. Granted the old laptop had been unused for around a year so any update in the last year could of fixed it in this case. Thanks for your input!
    Last edited by BradPJ (2013-06-13 11:35:16)

  • Symbolic links on Solaris 9 OS/Sun AS 8.01

    Hello, we are migrating several applications from SunAS 7 to SunAS8 and have several document directories that were set up on SunAS7. These appear to not be available in SunAS8. A symbolic link would work fine. We have attempted to implement the fix suggested in closed bugs #5015444, 6171573, and 6155565 which say to add the following to domain.xml and/or sun-web.xml:
    <property name="allowLinking" value="true"/>
    We have added this property and are still getting a 404 browser error. IS this correct or are we missing something? Or, are there any otherways to make content available to the application that is outside of the main war/ear file?
    Thanks in advance,
    Dave K.

    Yes, that's the stats of things in the AS 8.01 and AS 8.1 BETA releases.
    For the upcoming AS 8.1 FCS release, we have added a property named "allowLinking" to the <virtual-server> element in domain.xml, with the following meaning:
    - Determines whether symbolic links outside the virtual server's
    docroot are to be followed.
    - Is inherited by all web apps deployed in this virtual server.
    Notice that a webapp may override the inherited value by
    specifying its own "allowLinking" property in its sun-web.xml,
    like this:
    <sun-web-app>
    <property name="allowLinking" value="true" />
    </sun-web-app>
    Also in the upcoming AS 8.1 FCS, we've changed the default value of the virtual-server's "allowLinking" property to TRUE.
    Hope this helps.
    Jan

Maybe you are looking for

  • JAX-RPC: Web service where both server /and/ client are services?

    I'm considering a two-way Web service in an application that I'm designing and would appreciate any insight from prior experience. This will be a standard client-server application, where the server broadcasts messages and the client, in turn, can re

  • Changing sql server service and sql server agent service startup account in SQL Server hosting SharePoint DB

    Hi  i have a sharepoint deployment with one SQL Server (running on VM) hosting the config DB and another SQL Server (Physical Host because VM was running out of space) to host the huge Content DBs. I need to schedule automatic backups of the Content

  • Using tomcat 5 along with apache 2.2

    hi i am facing a strange problem i am trying to build a web application using servlets with tomcat 5 and apache 2.2 and i am using oracle 10g as the data base now when try to access the database from my pc it works fine but when i try to access it fr

  • How to show the photos tab in iTunes? Problem since ios 7 update.

    Where is the photo tab on iTunes? My iPad is listed on the left side in iTunes, but there is no photos tab. The left hand pane window in iTunes is maximized, but I do not see any tab for photos. Seems related to a recent update (IOS7?) as this was th

  • Appletviewer Please Help

    I feel bad about asking help. But I don't know where else to turn to. I searched the archives to no avail. I'm not sure this is a CLASSPATH problem or what but every time I run appletviewer I get "I/O exception while reading: E:\j2sdk1.4.0\bin\e:\jav