elhacker.net cabecera Bienvenido(a), Visitante. Por favor Ingresar o Registrarse
¿Perdiste tu email de activación?.

 

 


Tema destacado: Curso de javascript por TickTack


+  Foro de elhacker.net
|-+  Programación
| |-+  Scripting
| | |-+  Ayuda con esto porfas!!
0 Usuarios y 1 Visitante están viendo este tema.
Páginas: [1] Ir Abajo Respuesta Imprimir
Autor Tema: Ayuda con esto porfas!!  (Leído 2,525 veces)
TheTitan

Desconectado Desconectado

Mensajes: 7



Ver Perfil
Ayuda con esto porfas!!
« en: 13 Agosto 2007, 23:25 pm »

Hola soy nuevo en el foro.. ejejj ^^. bueno tengo solo una duda con respecto a batch, como puedo hacer que busque y elimine un archivo ....  es la ruta de donde esta el archivo que deseo borrar el que me complica, o sea logro encontrar el archivo pero nose como hacer para que tome la ruta de este y posterior mente lo borre...
@echo off
cd c:\
attrib /s /d "ARCHIVO"
he aqui donde no logro que tome la ruta...   :-\
del /q "ARCHIVO"
bueno esa es mi consulta, de antemano muchas gracias. ;D


En línea

Siuto
Ex-Staff
*
Desconectado Desconectado

Mensajes: 1.587


Que puedo decir??


Ver Perfil WWW
Re: Ayuda con esto porfas!!
« Respuesta #1 en: 15 Agosto 2007, 13:30 pm »

No es necesario para borrar un archivo que te posiciones en la carpeta donde se encuentra el mismo, lo podes hacer desde cualquier parte si escribis la ruta completa del archivo que queres borrar por ejemplo...

Código:
DEL [OPCIONES] [UNIDAD]:\[RUTA]\[ARCHIVO]

Haciendolo de esa forma podes hacerlo desde cualquier parte.


En línea

TheTitan

Desconectado Desconectado

Mensajes: 7



Ver Perfil
Re: Ayuda con esto porfas!!
« Respuesta #2 en: 15 Agosto 2007, 19:01 pm »

Muchas gracias por responder Siuto te lo agradezco.
mmm.... pero hay algun metodo de crear un batch que busque y elimine el archivo...algo asi como un buscador y eliminador jejejej xD.
que uno especifique lo que deve buscar y eliminar.
bueno.. muchas gracias por tu tiempo. ^^
En línea

Siuto
Ex-Staff
*
Desconectado Desconectado

Mensajes: 1.587


Que puedo decir??


Ver Perfil WWW
Re: Ayuda con esto porfas!!
« Respuesta #3 en: 16 Agosto 2007, 00:41 am »

El otro dia navegando por la web vi este programa no lo estudie a ver como funciona pero despues cuando pueda lo voy a hacer, sirve para buscar archivos miralo ahi te dejo el code y la explicacion.

Código:
:: LOC.bat
:: Locates Specified File Name
:: Searches from the Root or Current Directory & Below
:: Can Also Search a Specified Drive
:: Wildcards may be Used in File Name
::
::      Use `/S' to Search Current Directory & Below
::
@ECHO OFF

SET XSET=/UPPER
C:\DOS\XSET PARAMETER=%1
IF "%PARAMETER%" == "ALL" GOTO ALL-DRIVE
IF "%PARAMETER%" == "C" GOTO SPEC-DRIVE
IF "%PARAMETER%" == "D" GOTO SPEC-DRIVE
IF "%PARAMETER%" == "E" GOTO SPEC-DRIVE
IF "%PARAMETER%" == "/S" GOTO CURRENT
IF NOT "%PARAMETER%" == "/S" GOTO ROOT

:ALL-DRIVE
ECHO.
ECHO            Searching all Drives for " %2 "
ECHO.
FOR %%D IN (C: D: E:) DO DIR %%D\%2 /B /P /S
GOTO END

:SPEC-DRIVE
ECHO.
ECHO            Searching Drive %PARAMETER%: for " %2 "
ECHO.
DIR %1:\%2 /B /P /S
GOTO END

:CURRENT
XSET CUR-DIRECTORY DIR
ECHO.
ECHO            Searching %CUR-DIRECTORY% & Below for " %2 "
ECHO.
DIR %2 /B /P /S
GOTO END

:ROOT
ECHO.
ECHO            Searching Current Drive for " %1 "
ECHO.
DIR \%1 /B /P /S

:END
ECHO.
SET XSET=
SET PARAMETER=
SET CUR-DIRECTORY=

Explanation

    This begins by using XSET to make any command line parameters be passed to the batch file as upper case. This is to eliminate additional "IF" statements having to be used to cover lower-case entries. This technique was seen and explained earlier on this page in DRT.bat.

    The "IF" statements determine if you entered "ALL", a drive letter, a dot, or just a file name after the batch file name. If you enter "ALL", the "ALL-DRIVE" section comes into play. A message is placed on screen saying that all drives are being searched for the specified file. This section uses a FOR-IN-DO command to have DIR search for your file on each drive listed, from its root directory on down. It essentially says: "FOR each Directory listed INside the Brackets, DO a DIR listing for each of those Directories using the succeeding parameters and switches".

    A blank line is placed on screen as a separator via the "ECHO." in the preceding line, and then FOR-IN-DO has the DOS DIR command display any matches in a "Bare" format via the "/B". That means just the file and its path are seen. If the screen fills, DIR's "/P" parameter will pause after each screen full. This is done for each drive listed.

    However, if a specific drive letter was typed, the batch file branches to the "SPEC-DRIVE" section and displays, as above, any matching files found. If you have more or fewer drives, add or eliminate the drive "IF" statements, as necessary. Do the same for the drive letters listed inside the FOR-IN-DO brackets.

    Now, if "/S" was typed, only the current directory and below will be searched. If only a file name is typed, all of the current drive will be searched. In all cases, a message will tell you what is being searched and for what file, and the matching file(s) will displayed with a blank line above and the file with a path name will be shown.

Usage

    Simply type "LOC (file name)" to start a search of the current drive. If you wish to search another directory on the same drive from the one in which you are currently, enter its path without a backslash. Thus, if you are in C:\BATCH and wish to search C:\UTIL\ZIP, enter "LOC UTIL\ZIP\(file name)".

    Use a drive letter (with no colon) and the entire named drive will be searched. To search a sub-directory of that drive, use the directory path without a backslash. So if you were on the `E' drive, to locate all the .pcx files in your graphics directory and its subdirectories on the `C' drive, type "LOC C GRAPHICS\*.PCX". Be sure to have a space on either side of the drive letter.

    To search only the current directory and below, use "/S" as the first command line parameter. For the .pcx example, type "LOC /S *.PCX". Use "ALL" as a parameter to search every directory on every drive.

    Wildcards may be used if you want a range of files or can't remember the full name. Thus, typing "LOC ALL READ-ME.TXT" would find all such files anywhere within the drives you specified in the batch file. Similarity, typing "LOC ALL READ*.*" will find any file starting with "READ". If you are in any subdirectory and wish to locate such files just on the current drive, simply type "LOC READ*.*". With no parameters other than a file name, LOC.bat will always search the current drive in full.

    If you see the file you want and wish to stop the search, enter "CONTROL-C". Be sure to set BREAK to "ON" in your AUTOEXEC.bat so that DOS will stop immediately. If it is off, DOS will take longer to stop the search.

    XSET may be obtained from -xset.tripod.com.

Fuente: http://www.chebucto.ns.ca/~ak621/DOS/BatBasic.html#Basics
En línea

TheTitan

Desconectado Desconectado

Mensajes: 7



Ver Perfil
Re: Ayuda con esto porfas!!
« Respuesta #4 en: 16 Agosto 2007, 20:54 pm »

Muchas gracias es algo asi lo que quiero ^^.
voy a sacar alguna ideas de este programa... ;)
muchas gracias denuevo..
TheTitan  ::)
En línea

Páginas: [1] Ir Arriba Respuesta Imprimir 

Ir a:  

Mensajes similares
Asunto Iniciado por Respuestas Vistas Último mensaje
mouse (x, y) de un picture, ayuda porfas
Programación Visual Basic
elmatador2 6 4,239 Último mensaje 8 Julio 2016, 07:11 am
por elmatador2
ayuda con esto
Scripting
wolfblood 1 1,585 Último mensaje 8 Enero 2023, 05:33 am
por reymosquito
WAP2 - Aviso Legal - Powered by SMF 1.1.21 | SMF © 2006-2008, Simple Machines