I have a txt file on many folders and want to delete it


jk22

Well-known member
VIP
Local time
5:49 AM
Posts
190
OS
Windows 11 Pro
Hey guys,

I have alot of sub-folders like more than 100 in 1 folder and on all sub-folder there is 1 txt file which I want to delete it. Is there any way ? Or any Commandar can do it like Speed Commandar or Total Commandar or One Commandar ?

Regards.
 

My Computer My Computer

At a glance

Windows 11 ProIntel(R) Core(TM) i7-8665U CPU @ 1.90GHz 2.11...32 GBIntel(R) UHD Graphics 620
OS
Windows 11 Pro
Computer type
Laptop
Manufacturer/Model
Lenovo T490s
CPU
Intel(R) Core(TM) i7-8665U CPU @ 1.90GHz 2.11 GHz
Motherboard
Lenovo 20NYS6BN00
Memory
32 GB
Graphics Card(s)
Intel(R) UHD Graphics 620
Hard Drives
Kingston SNV251000G
Is the .txt file the same name in all folders, are there other .txt file in those folders?
And in which top folder of the drive do the .txt files reside?
 

My Computers My Computers

  • At a glance

    All Branches but ReleaseAMD Ryzen 7 7735HS 3200-4500 Mhz 8 cores x 232 GB DDR5Radeon Graphic / NVIDIA GeForce RTX 4060 8 GB...
    OS
    All Branches but Release
    Computer type
    Laptop
    Manufacturer/Model
    Acer Nitro ANV15-51
    CPU
    AMD Ryzen 7 7735HS 3200-4500 Mhz 8 cores x 2
    Motherboard
    Sportage_RBH
    Memory
    32 GB DDR5
    Graphics Card(s)
    Radeon Graphic / NVIDIA GeForce RTX 4060 8 GB GDDR6
    Sound Card
    AMD/Realtek(R) Audio
    Monitor(s) Displays
    Integrated Monitor (15.3"vis)
    Screen Resolution
    FHD 1920X1080 16:9 144Hz
    Hard Drives
    KINGSTON OM8SEP4512Q-AA 1TB
    Western Digital 256GB
    PSU
    19V DC 6.32 A 120 W
    Cooling
    Dual Fans
    Mouse
    MS Bluetooth
    Internet Speed
    Fiber 1GB Cox -us & 1GB Orange-fr
    Browser
    Edge Canary- Firefox Nightly-Chrome Dev-Chrome Dev
    Antivirus
    Windows Defender
  • At a glance

    Windows 11 BetaAMD A9-94208 GB of DDR4AMD Radeon R5
    Operating System
    Windows 11 Beta
    Computer type
    Laptop
    Manufacturer/Model
    Asus X751BP
    CPU
    AMD A9-9420
    Memory
    8 GB of DDR4
    Graphics card(s)
    AMD Radeon R5
    Screen Resolution
    1600x900
    Hard Drives
    Seagate 1 TB
Is the .txt file the same name in all folders, are there other .txt file in those folders?
And in which top folder of the drive do the .txt files reside?
Yes same name of that txt file in all folders and yes there are many other .txt files.

Its on my Desktop folder.
 

My Computer My Computer

At a glance

Windows 11 ProIntel(R) Core(TM) i7-8665U CPU @ 1.90GHz 2.11...32 GBIntel(R) UHD Graphics 620
OS
Windows 11 Pro
Computer type
Laptop
Manufacturer/Model
Lenovo T490s
CPU
Intel(R) Core(TM) i7-8665U CPU @ 1.90GHz 2.11 GHz
Motherboard
Lenovo 20NYS6BN00
Memory
32 GB
Graphics Card(s)
Intel(R) UHD Graphics 620
Hard Drives
Kingston SNV251000G
Open your desktop folder thru explorer
In the address bar, type in cmd > enter
at a command prompt:
del [yourtxtfilename].txt /s /p
This will delete that text file recursively stopping at each page (for you to verify- press enter to continue)
 

My Computers My Computers

  • At a glance

    All Branches but ReleaseAMD Ryzen 7 7735HS 3200-4500 Mhz 8 cores x 232 GB DDR5Radeon Graphic / NVIDIA GeForce RTX 4060 8 GB...
    OS
    All Branches but Release
    Computer type
    Laptop
    Manufacturer/Model
    Acer Nitro ANV15-51
    CPU
    AMD Ryzen 7 7735HS 3200-4500 Mhz 8 cores x 2
    Motherboard
    Sportage_RBH
    Memory
    32 GB DDR5
    Graphics Card(s)
    Radeon Graphic / NVIDIA GeForce RTX 4060 8 GB GDDR6
    Sound Card
    AMD/Realtek(R) Audio
    Monitor(s) Displays
    Integrated Monitor (15.3"vis)
    Screen Resolution
    FHD 1920X1080 16:9 144Hz
    Hard Drives
    KINGSTON OM8SEP4512Q-AA 1TB
    Western Digital 256GB
    PSU
    19V DC 6.32 A 120 W
    Cooling
    Dual Fans
    Mouse
    MS Bluetooth
    Internet Speed
    Fiber 1GB Cox -us & 1GB Orange-fr
    Browser
    Edge Canary- Firefox Nightly-Chrome Dev-Chrome Dev
    Antivirus
    Windows Defender
  • At a glance

    Windows 11 BetaAMD A9-94208 GB of DDR4AMD Radeon R5
    Operating System
    Windows 11 Beta
    Computer type
    Laptop
    Manufacturer/Model
    Asus X751BP
    CPU
    AMD A9-9420
    Memory
    8 GB of DDR4
    Graphics card(s)
    AMD Radeon R5
    Screen Resolution
    1600x900
    Hard Drives
    Seagate 1 TB
Open your desktop folder thru explorer
In the address bar, type in cmd > enter
at a command prompt:
del [yourtxtfilename].txt /s /p
This will delete that text file recursively stopping at each page (for you to verify- press enter to continue)
That command will delete that .txt file from all sub-folders ?
 

My Computer My Computer

At a glance

Windows 11 ProIntel(R) Core(TM) i7-8665U CPU @ 1.90GHz 2.11...32 GBIntel(R) UHD Graphics 620
OS
Windows 11 Pro
Computer type
Laptop
Manufacturer/Model
Lenovo T490s
CPU
Intel(R) Core(TM) i7-8665U CPU @ 1.90GHz 2.11 GHz
Motherboard
Lenovo 20NYS6BN00
Memory
32 GB
Graphics Card(s)
Intel(R) UHD Graphics 620
Hard Drives
Kingston SNV251000G
That is what you asked for? Right?
Of course, you need to replace [yourtxtfilename] with your file name without brackets and there is a space between /s & /p
 

My Computers My Computers

  • At a glance

    All Branches but ReleaseAMD Ryzen 7 7735HS 3200-4500 Mhz 8 cores x 232 GB DDR5Radeon Graphic / NVIDIA GeForce RTX 4060 8 GB...
    OS
    All Branches but Release
    Computer type
    Laptop
    Manufacturer/Model
    Acer Nitro ANV15-51
    CPU
    AMD Ryzen 7 7735HS 3200-4500 Mhz 8 cores x 2
    Motherboard
    Sportage_RBH
    Memory
    32 GB DDR5
    Graphics Card(s)
    Radeon Graphic / NVIDIA GeForce RTX 4060 8 GB GDDR6
    Sound Card
    AMD/Realtek(R) Audio
    Monitor(s) Displays
    Integrated Monitor (15.3"vis)
    Screen Resolution
    FHD 1920X1080 16:9 144Hz
    Hard Drives
    KINGSTON OM8SEP4512Q-AA 1TB
    Western Digital 256GB
    PSU
    19V DC 6.32 A 120 W
    Cooling
    Dual Fans
    Mouse
    MS Bluetooth
    Internet Speed
    Fiber 1GB Cox -us & 1GB Orange-fr
    Browser
    Edge Canary- Firefox Nightly-Chrome Dev-Chrome Dev
    Antivirus
    Windows Defender
  • At a glance

    Windows 11 BetaAMD A9-94208 GB of DDR4AMD Radeon R5
    Operating System
    Windows 11 Beta
    Computer type
    Laptop
    Manufacturer/Model
    Asus X751BP
    CPU
    AMD A9-9420
    Memory
    8 GB of DDR4
    Graphics card(s)
    AMD Radeon R5
    Screen Resolution
    1600x900
    Hard Drives
    Seagate 1 TB
One thing I've used is clicking the main/first folder, go to Search and enter *.txt and search then Select all then delete the files found. The * is a wild card if not needing to know the whole file name.
 

My Computers My Computers

  • At a glance

    Win11 Pro RTM Version 24H2 Build 26100.4202Intel Core i5 11th Gen. 2.40GHz12GB
    OS
    Win11 Pro RTM Version 24H2 Build 26100.4202
    Computer type
    Laptop
    Manufacturer/Model
    Dell Vostro 3400
    CPU
    Intel Core i5 11th Gen. 2.40GHz
    Memory
    12GB
    Hard Drives
    256GB SSD NVMe M.2
  • At a glance

    Win11 Pro RTM Version 24H2 Build 26100.4202Intel Core i5 10th Gen. 2.90GHz16GBOnboard, no VGA, using a DisplayPort-to-VGA a...
    Operating System
    Win11 Pro RTM Version 24H2 Build 26100.4202
    Computer type
    PC/Desktop
    Manufacturer/Model
    Dell Vostro 5890
    CPU
    Intel Core i5 10th Gen. 2.90GHz
    Memory
    16GB
    Graphics card(s)
    Onboard, no VGA, using a DisplayPort-to-VGA adapter
    Monitor(s) Displays
    24" Dell
    Hard Drives
    512GB SSD NVMe, 4TB Seagate HDD
    Browser
    Firefox, Edge
    Antivirus
    Windows Defender/Microsoft Security
  • Like
Reactions: OAT
That command will delete that .txt file from all sub-folders ?
All except ones that are hidden or have their read-only attribute set. You can add the /A option to also delete files that are hidden, and/or can add the /F option to also delete files that are read-only. So del [yourtxtfilename].txt /s /p /a /f will delete all occurrences of the specified file, also including in subfolders and also including if the file is hidden and/or is read-only.

EDIT: If you prefer, you can omit the /P option and instead redirect the output of the command to a new textfile. For example, del [yourtxtfilename].txt /s >"%userprofile%\Desktop\DeletedFiles.txt" will write the command's output to a textfile DeletedFiles.txt that will be created on your desktop. (If the file DeletedFiles.txt already exists on your desktop, it will be overwritten.)
 
Last edited:

My Computers My Computers

  • At a glance

    11 Homei7 13650HX16GB DDR5GeForce RTX 4060 Mobile
    OS
    11 Home
    Computer type
    Laptop
    Manufacturer/Model
    Asus TUF Gaming F16 (2024)
    CPU
    i7 13650HX
    Memory
    16GB DDR5
    Graphics Card(s)
    GeForce RTX 4060 Mobile
    Sound Card
    Eastern Electric MiniMax DAC Supreme; Emotiva UMC-200; Astell & Kern AK240
    Monitor(s) Displays
    Sony Bravia XR-55X90J
    Screen Resolution
    3840×2160
    Hard Drives
    512GB SSD internal
    37TB external
    PSU
    Li-ion
    Cooling
    2× Arc Flow Fans, 4× exhaust vents, 5× heatpipes
    Keyboard
    Logitech K800
    Mouse
    Logitech G402
    Internet Speed
    30Mbit/s up, 500Mbit/s down
    Browser
    FF
    Antivirus
    What's an antivirus?
  • At a glance

    11 Homei5 1135G716GB DDR4Intel Iris Xe
    Operating System
    11 Home
    Computer type
    Laptop
    Manufacturer/Model
    Medion S15450
    CPU
    i5 1135G7
    Memory
    16GB DDR4
    Graphics card(s)
    Intel Iris Xe
    Sound Card
    Eastern Electric MiniMax DAC Supreme; Emotiva UMC-200; Astell & Kern AK240
    Monitor(s) Displays
    Sony Bravia XR-55X90J
    Screen Resolution
    3840×2160
    Hard Drives
    2TB SSD internal
    37TB external
    PSU
    Li-ion
    Keyboard
    Logitech K800
    Mouse
    Logitech G402
    Internet Speed
    30Mbit/s up, 500Mbit/s down
    Browser
    FF
Open your desktop folder thru explorer
In the address bar, type in cmd > enter
at a command prompt:
del [yourtxtfilename].txt /s /p
This will delete that text file recursively stopping at each page (for you to verify- press enter to continue)
Its say this:
9c15695995.png


Well it have $ sign aswell maybe cmd is not accepting special character ?
 

My Computer My Computer

At a glance

Windows 11 ProIntel(R) Core(TM) i7-8665U CPU @ 1.90GHz 2.11...32 GBIntel(R) UHD Graphics 620
OS
Windows 11 Pro
Computer type
Laptop
Manufacturer/Model
Lenovo T490s
CPU
Intel(R) Core(TM) i7-8665U CPU @ 1.90GHz 2.11 GHz
Motherboard
Lenovo 20NYS6BN00
Memory
32 GB
Graphics Card(s)
Intel(R) UHD Graphics 620
Hard Drives
Kingston SNV251000G
No $ sign is OK,
Can you from the same location (top), do
Attrib -h -r -s *.* /d (you may get an access denied if some files are in use)
and then do the delete command above.
Please attach a screenshot if that does not work.
 

My Computers My Computers

  • At a glance

    All Branches but ReleaseAMD Ryzen 7 7735HS 3200-4500 Mhz 8 cores x 232 GB DDR5Radeon Graphic / NVIDIA GeForce RTX 4060 8 GB...
    OS
    All Branches but Release
    Computer type
    Laptop
    Manufacturer/Model
    Acer Nitro ANV15-51
    CPU
    AMD Ryzen 7 7735HS 3200-4500 Mhz 8 cores x 2
    Motherboard
    Sportage_RBH
    Memory
    32 GB DDR5
    Graphics Card(s)
    Radeon Graphic / NVIDIA GeForce RTX 4060 8 GB GDDR6
    Sound Card
    AMD/Realtek(R) Audio
    Monitor(s) Displays
    Integrated Monitor (15.3"vis)
    Screen Resolution
    FHD 1920X1080 16:9 144Hz
    Hard Drives
    KINGSTON OM8SEP4512Q-AA 1TB
    Western Digital 256GB
    PSU
    19V DC 6.32 A 120 W
    Cooling
    Dual Fans
    Mouse
    MS Bluetooth
    Internet Speed
    Fiber 1GB Cox -us & 1GB Orange-fr
    Browser
    Edge Canary- Firefox Nightly-Chrome Dev-Chrome Dev
    Antivirus
    Windows Defender
  • At a glance

    Windows 11 BetaAMD A9-94208 GB of DDR4AMD Radeon R5
    Operating System
    Windows 11 Beta
    Computer type
    Laptop
    Manufacturer/Model
    Asus X751BP
    CPU
    AMD A9-9420
    Memory
    8 GB of DDR4
    Graphics card(s)
    AMD Radeon R5
    Screen Resolution
    1600x900
    Hard Drives
    Seagate 1 TB
One thing I've used is clicking the main/first folder, go to Search and enter *.txt and search then Select all then delete the files found. The * is a wild card if not needing to know the whole file name.
I have used your trick and it worked.
No $ sign is OK,
Can you from the same location (top), do
Attrib -h -r -s *.* /d (you may get an access denied if some files are in use)
and then do the delete command above.
Please attach a screenshot if that does not work.
I have used the search option from Search This PC and it worked.
 

My Computer My Computer

At a glance

Windows 11 ProIntel(R) Core(TM) i7-8665U CPU @ 1.90GHz 2.11...32 GBIntel(R) UHD Graphics 620
OS
Windows 11 Pro
Computer type
Laptop
Manufacturer/Model
Lenovo T490s
CPU
Intel(R) Core(TM) i7-8665U CPU @ 1.90GHz 2.11 GHz
Motherboard
Lenovo 20NYS6BN00
Memory
32 GB
Graphics Card(s)
Intel(R) UHD Graphics 620
Hard Drives
Kingston SNV251000G
  • Like
Reactions: OAT
Good, I am glad.
 

My Computers My Computers

  • At a glance

    All Branches but ReleaseAMD Ryzen 7 7735HS 3200-4500 Mhz 8 cores x 232 GB DDR5Radeon Graphic / NVIDIA GeForce RTX 4060 8 GB...
    OS
    All Branches but Release
    Computer type
    Laptop
    Manufacturer/Model
    Acer Nitro ANV15-51
    CPU
    AMD Ryzen 7 7735HS 3200-4500 Mhz 8 cores x 2
    Motherboard
    Sportage_RBH
    Memory
    32 GB DDR5
    Graphics Card(s)
    Radeon Graphic / NVIDIA GeForce RTX 4060 8 GB GDDR6
    Sound Card
    AMD/Realtek(R) Audio
    Monitor(s) Displays
    Integrated Monitor (15.3"vis)
    Screen Resolution
    FHD 1920X1080 16:9 144Hz
    Hard Drives
    KINGSTON OM8SEP4512Q-AA 1TB
    Western Digital 256GB
    PSU
    19V DC 6.32 A 120 W
    Cooling
    Dual Fans
    Mouse
    MS Bluetooth
    Internet Speed
    Fiber 1GB Cox -us & 1GB Orange-fr
    Browser
    Edge Canary- Firefox Nightly-Chrome Dev-Chrome Dev
    Antivirus
    Windows Defender
  • At a glance

    Windows 11 BetaAMD A9-94208 GB of DDR4AMD Radeon R5
    Operating System
    Windows 11 Beta
    Computer type
    Laptop
    Manufacturer/Model
    Asus X751BP
    CPU
    AMD A9-9420
    Memory
    8 GB of DDR4
    Graphics card(s)
    AMD Radeon R5
    Screen Resolution
    1600x900
    Hard Drives
    Seagate 1 TB
I have used your trick and it worked.
Good. And it's not actually a 'trick' but a feature of the file managers, goes back a'ways.
 

My Computers My Computers

  • At a glance

    Win11 Pro RTM Version 24H2 Build 26100.4202Intel Core i5 11th Gen. 2.40GHz12GB
    OS
    Win11 Pro RTM Version 24H2 Build 26100.4202
    Computer type
    Laptop
    Manufacturer/Model
    Dell Vostro 3400
    CPU
    Intel Core i5 11th Gen. 2.40GHz
    Memory
    12GB
    Hard Drives
    256GB SSD NVMe M.2
  • At a glance

    Win11 Pro RTM Version 24H2 Build 26100.4202Intel Core i5 10th Gen. 2.90GHz16GBOnboard, no VGA, using a DisplayPort-to-VGA a...
    Operating System
    Win11 Pro RTM Version 24H2 Build 26100.4202
    Computer type
    PC/Desktop
    Manufacturer/Model
    Dell Vostro 5890
    CPU
    Intel Core i5 10th Gen. 2.90GHz
    Memory
    16GB
    Graphics card(s)
    Onboard, no VGA, using a DisplayPort-to-VGA adapter
    Monitor(s) Displays
    24" Dell
    Hard Drives
    512GB SSD NVMe, 4TB Seagate HDD
    Browser
    Firefox, Edge
    Antivirus
    Windows Defender/Microsoft Security
Good. And it's not actually a 'trick' but a feature of the file managers, goes back a'ways.
Yes you are right which I forgot to use it lol.
 

My Computer My Computer

At a glance

Windows 11 ProIntel(R) Core(TM) i7-8665U CPU @ 1.90GHz 2.11...32 GBIntel(R) UHD Graphics 620
OS
Windows 11 Pro
Computer type
Laptop
Manufacturer/Model
Lenovo T490s
CPU
Intel(R) Core(TM) i7-8665U CPU @ 1.90GHz 2.11 GHz
Motherboard
Lenovo 20NYS6BN00
Memory
32 GB
Graphics Card(s)
Intel(R) UHD Graphics 620
Hard Drives
Kingston SNV251000G
Back
Top Bottom