Sponsored Content
Special Forums Windows & DOS: Issues & Discussions Windows batch command for deleting particular pattern named folders in temp Post 303031265 by onenessboy on Monday 25th of February 2019 05:54:49 AM
Old 02-25-2019
Windows batch command for deleting particular pattern named folders in temp

Hi All,'

I need to write a windows bat program to delete particular folders with naming pattern scoped_dir45666 (for example)(including contents)
with batch program. For that I am using below code:
Code:
@echo off
cd /D %temp%
for /d %%D in (*) do rd /s /q "%%D"
del /f /q *

i got above code from some forum, but its deleting everything causing system issues...(its screwing some os files also I guess)

I need to delete all directories names starting with scoped_dirxxxxx (scoped_dir*) can some one advise how to modify above code to delete only folders name starting with scoped_dir in %temp% folder




Moderator's Comments:
Mod Comment Please use CODE (not ICODE) tags as required by forum rules!

Last edited by joeyg; 02-27-2019 at 12:04 PM..
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Deleting a batch of print jobs

Hi Guys I have over 2000+ print jobs in one queue which I would like to delete. Is there away in AIX 4.3 that I can delete the whole print jobs at ocne. Instead of one at a time. Thanks (1 Reply)
Discussion started by: orvelb
1 Replies

2. Shell Programming and Scripting

During deleting just miss some folders

There is directory test: > ls -rtl total 12 drwxr-xr-x 2 root sys 4096 Aug 17 09:57 test2 -rw-r--r-- 1 user1 group1 16 Aug 17 10:00 test -rw-r--r-- 1 user1 group1 16 Aug 17 10:00 test1 -rw-r--r-- 1 user1 group1 16 Aug 17 10:01 test12 -rw-r--r-- 1 user1 group1 16 Aug 17 10:01 test13 ... (5 Replies)
Discussion started by: user_junior
5 Replies

3. Shell Programming and Scripting

deleting files and folders matching criteria

Hello, I'm spendind hours trying to figure out how a script could remove files and folders older than 30days in a given volume (/dataVolumes/Booba.1.0). Within this volume, all users have their personal folder that starts with "RC-..", so the script should skip them for deletion. I will... (4 Replies)
Discussion started by: H3001
4 Replies

4. Shell Programming and Scripting

Searching a pattern in file and deleting th ewhole line containing the pattern

Hi All, Please can someone assist in the script I have made that searches a pattern in a file and delete the whole line containing the pattern. #!bin/sh # The pattern that user want to add to the files echo "Enter the pattern of the redirect" read value # check if the user has... (1 Reply)
Discussion started by: Shazin
1 Replies

5. Shell Programming and Scripting

Deleting files without folders.

How can I delete all the files in subfolders without folders (preserving directory scructure). P.S. I have a huge variety of computer books organized in subfolders (admin web hardw programming_langs) .. but I don't need them - the only way to know something now is GOOGLE (I've realized now)...... (1 Reply)
Discussion started by: Xcislav
1 Replies

6. Shell Programming and Scripting

Deleting empty folders

Hey, I need help with writing a shell script that deletes empty folders..anyone? :) Thank you! (5 Replies)
Discussion started by: putukas
5 Replies

7. UNIX for Dummies Questions & Answers

Deleting a pattern in UNIX without deleting the entire line

Hi I have a file: r58778.3|SOURCES={KEY=f665931a...,fw,221-705}|ERRORS={16_1:T,30_1:T,56_1:C,57_1:T,59_1:A,101_1:A,115:-,158_1:C,186_1:A,204:-,271_1:T,305:-,350_1:C,368_1:G,442_1:C,472_1:G,477_1:A}|SOURCE_1="Contig_1092402550638"(f665931a359e36cea0976db191ff60ff09cc816e) I want to retain... (15 Replies)
Discussion started by: Alyaa
15 Replies

8. Shell Programming and Scripting

Deleting file named *

Hi, There is a file by name '*' in a hp-ux box. How can i delete the same? -rw-r--r-- 1 wleadm dba 1531 Jul 24 08:49 * need to delete this file named * without deleting any other file. Please help. (9 Replies)
Discussion started by: sam_bd
9 Replies

9. Shell Programming and Scripting

Help with Deleting Folders Script

Hi all new to the forums. Very beginner at shell scripting. What I'm trying to do is this: Is the directory empty prior to removal of it? If not, inform the user that the directory is not empty and if the user wants to remove it remove or move the files in it first. But I'm stuck.. It checks... (3 Replies)
Discussion started by: rduckett1456
3 Replies

10. UNIX for Dummies Questions & Answers

Rsync not deleting destination files/folders

Hi All, I want delete all files from destination folder. I am trying below commands rsync -avFF --delete-after /home/vizion/source/ /home/vizion/destination/ I need to be delete all file/fodders from destination Any body have idea ? Please correct me. (3 Replies)
Discussion started by: Chenchireddy
3 Replies
ipsec_config_batch(1M)													    ipsec_config_batch(1M)

NAME
ipsec_config_batch - allow for processing of IPsec config operations in a single batch file SYNOPSIS
batch_file_name profile_file] DESCRIPTION
The command allows you to specify multiple and operations in a single batch file for processing. HP-UX IPSec processes the operations in a batch file as a group. This mode is useful if you are adding or deleting configuration records that may affect other records. If one operation is invalid, all operations in the batch file fail. The utility first verifies each operation in the batch file for syntax errors and collisions (object names and priority values) with existing entries in the configuration database. If all operations in the batch file are valid, the HP-UX IPSec infrastructure updates the configuration database with all operations at the same time. If HP-UX IPSec is active and running, the HP-UX IPSec infrastructure also updates the runtime policy database. Options and Operands The batch operation recognizes the following options and operands: batch_file_name The name of the batch file containing and operations. A batch file cannot contain operations that operate on the following objects: For example, the operation is illegal in a batch file. In addition, a batch file cannot contain the following commands: o does not allow recursive batch files) or commands. o o Lines starting with a pound sign are interpreted as comments. Comment lines within an operation are not allowed. Maximum length: 1023 characters. Default: None. The utility verifies the and operations, but does not add or delete entries in the configuration database. This option applies to all operations in the batch file. Individual operations in the batch file cannot specify the option. Specifies the name of the profile file containing default argument values for this policy. The argument values are evaluated once, when the policy is added to the configuration database. Val- ues used from the profile file become part of the configuration record for the policy. This argument applies to all operations in the batch file. Individual operations in the batch file cannot specify the profile argument. Maximum length: 1023 characters. Default: EXAMPLES
The file contains the following entries: AUTHOR
was developed by HP. FILES
configuration database. default profile file. SEE ALSO
ipsec_admin(1M), ipsec_config(1M), ipsec_config_add(1M), ipsec_config_delete(1M), ipsec_config_export(1M), ipsec_config_show(1M), ipsec_migrate(1M), ipsec_policy(1M), ipsec_report(1M). HP-UX IPSec Software Required ipsec_config_batch(1M)
All times are GMT -4. The time now is 11:15 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy