Welcome guest. Before posting on our computer help forum, you must register. Click here it's easy and free.

Author Topic: Does . Mean A Wildcard?  (Read 2854 times)

0 Members and 1 Guest are viewing this topic.

Nexusfactor

    Topic Starter


    Rookie

    • Experience: Experienced
    • OS: Windows 7
    Does . Mean A Wildcard?
    « on: January 02, 2016, 07:22:27 AM »
    I was looking for away to use a batch file to properly remove sub folders/files but leave the parent directory. I found this code on SO:

    Code: [Select]
    cd "%USERPROFILE%\Desktop\cache"
    rd /s /q .

    What does the . after the q mean? I tried it in a batch file without the . and it gave me an error. With the dot, it worked, and gave me and error that the SO post said was supposed to happen(because the directory you are cleaning is use). Is the . a wildcard, sort of like *.* ? So remove all files and folder regardless of names/extension?
    The world's #1 Antifeminist

    DaveLembke



      Sage
    • Thanked: 662
    • Certifications: List
    • Computer: Specs
    • Experience: Expert
    • OS: Windows 10
    Re: Does . Mean A Wildcard?
    « Reply #1 on: January 02, 2016, 10:17:55 AM »
    Its to target the current path for the RD instruction I believe in which the batch is being executed from. Similar to how CD . works. While CD .. beings you back 1 level. CD . will keep you at the same level of the directory tree. If you type CD without a . or .. or \ it will just echo back to prompt for example.

    Salmon Trout

    • Guest
    Re: Does . Mean A Wildcard?
    « Reply #2 on: January 02, 2016, 11:35:39 AM »
    In Windows rd /s /q . is a trick rather than an official method, when trying to delete the current directory it fails (of course) and returns the message "The process cannot access the file because it is being used by another process."