China DOS Union

-- Unite DOS · Advance DOS · Grow DOS --

Union site: www.cn-dos.net Forum site: www.cn-dos.net/forum
DOS stands for freedom, openness and progress. Let us work hard, learn from the openness and GNU spirit of FreeDOS and Linux, and together build and grow a free GNU GPL world!

中国DOS联盟论坛
The time now is 2026-08-12 19:27
中国DOS联盟论坛 » DOS批处理 & 脚本技术(批处理室) » Experts, please help look at this batch file for an undeletable folder View 4,971 Replies 46
Original Poster Posted 2008-06-25 00:40 ·  中国 山西 太原 联通
初级用户
Credits 42
Posts 19
Joined 2005-12-23 21:16
20-year member
UID 47750
Status Offline
I want to put this batch file into any directory I need. After running it, it should create an undeletable folder named sm. in that directory, and copy all files and folders in that directory into the undeletable folder sm.. With copy I can only copy files, not folders. How should I handle it with xcopy? Please give me some pointers, experts! The contents are as follows:

@echo off&mode con cols=50 lines=12
title Create or delete a private folder
if not exist sm..\nul (
md sm..\
color 5a&cls&echo.&echo The private folder has been created! Files will be put into the private folder...&ping/n 2 127.1>nul
echo Copying files...
copy %CurDir% * sm..\>nul 2>nul
) else (
rd /s/q sm..\
color 5e&cls&echo.&echo The private folder has been deleted!&ping/n 2 127.1>nul
)
color 5b&cls&echo.&echo Run it again to recreate or delete!&ping/n 2 127.1>nul
Floor 2 Posted 2008-06-25 00:44 ·  中国 山东 淄博 联通
银牌会员
★★★
Credits 1,604
Posts 646
Joined 2008-04-13 23:39
18-year member
UID 115804
Gender Male
Status Offline
I'm not interested in weird folders.
Can't help you...
Just helping bump the thread...
But you can use the "folder extension" trick to hide your stuff in c:\windows\tasks. Be sure to use the copy command, otherwise the graphical interface won't work...
Also places like the browser, Control Panel, My Network Places, Administrative Tools, and Recycle Bin are all good places to hide files....
心绪平和,眼藏静谧,无比安稳的火... Purification of soul...Just a false...^_^
Floor 3 Posted 2008-06-25 01:01 ·  中国 山西 太原 联通
初级用户
Credits 42
Posts 19
Joined 2005-12-23 21:16
20-year member
UID 47750
Status Offline
I also posted on the VeryBatch forum and nobody solved it there either, depressing!!
Floor 4 Posted 2008-06-25 01:04 ·  中国 重庆 电信
版主
★★★★★
Credits 9,023
Posts 5,017
Joined 2007-05-31 19:39
19-year member
UID 89899
Gender Male
Status Offline
xcopy probably can't copy things into a weird folder
OP isn't from the national nuclear submarine training center, is he

Credits 4
Posts 1
Registered 2005-12-23
Status Online
Floor 5 Posted 2008-06-25 01:20 ·  法国
高级用户
★★
Credits 783
Posts 268
Joined 2006-12-26 17:18
19-year member
UID 74627
Gender Male
Status Offline
Lurking for three years without showing up, huh. A rare talent, a rare talent!
菩提本无树,明镜亦非台,本来无一物,何处惹尘埃.
Floor 6 Posted 2008-06-25 01:21 ·  中国 山西 太原 联通
初级用户
Credits 42
Posts 19
Joined 2005-12-23 21:16
20-year member
UID 47750
Status Offline
Hahahaha, brother hat, you're making fun of me. True indeed!
Floor 7 Posted 2008-06-25 12:04 ·  中国 上海 东方有线
贫困用户
Credits -5
Posts 11
Joined 2008-06-24 12:00
18-year member
UID 120760
Gender Male
Status Offline
Don't understand it, just bumping
Floor 8 Posted 2008-06-25 21:45 ·  中国 福建 三明 电信
中级用户
★★
Credits 458
Posts 211
Joined 2006-07-26 19:42
20-year member
UID 59307
Status Offline
xcopy doesn't handle the current directory very well like this.
If the dotted directory isn't under the current directory, it'll be easier.
┌───────┐
├→学习→实践→┤
└───────┘
Floor 9 Posted 2008-06-26 16:14 ·  中国 河南 郑州 联通
新手上路
Credits 16
Posts 9
Joined 2008-06-25 00:48
18-year member
UID 120775
Gender Male
Status Offline
You really are an expert to write such a complicated command!
Floor 10 Posted 2008-06-27 11:07 ·  中国 山西 太原 联通
初级用户
Credits 42
Posts 19
Joined 2005-12-23 21:16
20-year member
UID 47750
Status Offline
Still nobody can solve it?
Floor 11 Posted 2008-06-27 11:23 ·  中国 辽宁 营口 中移铁通
中级用户
★★
Credits 206
Posts 93
Joined 2007-08-16 17:19
18-year member
UID 95263
Gender Male
Status Offline
Why not just directly create a folder you want to copy? Then copy all the files under that folder into the folder you just created ??
Floor 12 Posted 2008-06-27 11:44 ·  中国 广东 揭阳 电信
新手上路
Credits 12
Posts 2
Joined 2007-10-22 10:41
18-year member
UID 100404
Gender Male
Status Offline
copy %CurDir% * sm6b7e~1>nul 2>nul

Don't ask me why, use dir /x yourself and you'll know
Recent Ratings for This Post ( 1 in total) Click for details
RaterScoreTime
moniuming +8 2008-06-27 23:13
Floor 13 Posted 2008-06-27 11:58 ·  美国 惠普HP
版主
★★★★★
Credits 9,023
Posts 5,017
Joined 2007-05-31 19:39
19-year member
UID 89899
Gender Male
Status Offline
Originally posted by wingface at 2008-6-27 11:44 AM:
copy %CurDir% * sm6b7e~1>nul 2>nul

Don't ask me why, use dir /x yourself and you'll know

Nice job!
Floor 14 Posted 2008-06-27 19:18 ·  中国 广东 广州 电信
银牌会员
★★★
永远的菜鸟
Credits 1,335
Posts 574
Joined 2007-11-27 12:50
18-year member
UID 103929
Gender Male
From 广西
Status Offline
@echo off
for /l %%a in (1 1 10000) do set "n=%%a"
echo After %n% tests, I found that xcopy and move cannot operate on weird directories
pause>nul
Floor 15 Posted 2008-06-27 20:27 ·  美国 惠普HP
版主
★★★★★
Credits 9,023
Posts 5,017
Joined 2007-05-31 19:39
19-year member
UID 89899
Gender Male
Status Offline
Using the method in post #12, xcopy can operate on weird directories
Recent Ratings for This Post ( 1 in total) Click for details
RaterScoreTime
moniuming +8 2008-06-27 23:13
Forum Jump: