Algun Programa Para Modificar Metadatos De Archivo Sqlite?


Subject: Algun Programa Para Modificar Metadatos De Archivo Sqlite?
buenas, estoy trabajando en la rutina de respaldo automático del programa taller 2015 y necesito modificar la fecha de modificación de la base de datos para hacer pruebas
y verificar que la rutina trabaja bien, alguien sabe como hacerlo o algún programa que permita hacerlo?
Public Sub RespaldarAhora()
Dim FechaM As Date
Dim BD As String
Dim RespaldarSi As Boolean
Dim Diferencia As Byte

DirRespaldo = Settings["RespaldoAutomatico/DirRespaldo", RespaldoBD]
CadaTanto = Settings["RespaldoAutomatico/Periodo", 0]

BD = FMain.CarpetaTaller &/ "basetaller"
If Exist(BD) Then
FechaM = Stat(BD).LastModified
Endif

ArchivoX = FMain.DirRespaldo &/ "basetaller_" & Replace$(CString(Date), "/", "-")
Diferencia = DateDiff(Date, FechaM, gb.Day)

Print "Diferencia=" & Diferencia

Select Case CadaTanto
Case 0 ' respaldo cada 1 dia
If Diferencia >= 1 Then RespaldarSi = True
Case 1 ' respaldo cada 2 dias
If Diferencia >= 2 Then RespaldarSi = True
Case 2 ' respaldo cada 3 dias
If Diferencia >= 3 Then RespaldarSi = True
Case 3 ' respaldo cada 4 dias
If Diferencia >= 4 Then RespaldarSi = True
Case 4 ' respaldo cada 5 dias
If Diferencia >= 5 Then RespaldarSi = True
Case 5 ' respaldo cada una semana
If Diferencia >= 7 Then RespaldarSi = True
Case 6 ' respaldo cada 15 dias
If Diferencia >= 15 Then RespaldarSi = True
Case 7 ' respaldo cada un mes
If Diferencia >= 30 Then RespaldarSi = True
End Select

If RespaldarSi = True Then
If Exist(ArchivoX) = False Then
If Access(File.Dir(ArchivoX), gb.Write) = True Then
Copy BD To ArchivoX
Wait 0.2
VerificarRespaldo
Else
TextoMSG("Error:" & Error.Text & gb.NewLine & Error.Where, True)
Endif
Else
If bVerMensaje = True Then
TextoMSG("Respaldo ya existe:" & gb.NewLine & ArchivoX, True)
bVerMensaje = False
Endif
Endif
Endif

End

Public Sub VerificarRespaldo()
If Exist(ArchivoX) Then
Goto RESPALDO_CORRECTO
Else
Goto ERROR_RESPALDO
Endif

RESPALDO_CORRECTO:
TextoMSG("Se respaldo correctamente en:" & gb.NewLine & ArchivoX, False)
' Message.Info("Se respaldo correctamente en:" & gb.NewLine & ArchivoX)
Goto SALIR

ERROR_RESPALDO:
TextoMSG("Ocurrio un error:" & gb.NewLine & Error.Text & gb.NewLine & Error.Where, True)

SALIR:

End

Last edited by v3ctor on Monday, 04 May 2015, 19:47; edited 1 time in total
Subject: Re: Algun Programa Para Modificar Metadatos De Archivo Sqlite?
Comando touch del sistema para modificarlo. man touch para ver las opciones

En gambas clase stat para consultarlo:

FechaModified = Stat(midocum).LastModified

Profile PM  
Subject: Re: Algun Programa Para Modificar Metadatos De Archivo Sqlite?
gracias shordi, dejo un ejemplo básico de uso:

en este caso el archivo a modificar la fecha de modificación es un archivo sqlite llamado basetaller

prueba1@postapase-desktop ~/Taller2015 $ touch -a -m -t 201503150000.00 basetaller

para ver cambios:

prueba1@postapase-desktop ~/Taller2015 $ stat basetaller
Fichero: «basetaller»
Tamaño: 39936 Bloques: 80 Bloque E/S: 4096 fichero regular
Dispositivo: 815h/2069d Nodo-i: 1054804 Enlaces: 1
Acceso: (0644/-rw-r--r--) Uid: ( 1001/ prueba1) Gid: ( 1001/ prueba1)
Acceso: 2015-03-15 00:00:00.000000000 -0300
Modificación: 2015-03-15 00:00:00.000000000 -0300
Cambio: 2015-05-04 16:51:24.106622979 -0300
Creación: -

Subject: Re: Algun Programa Para Modificar Metadatos De Archivo Sqlite?
jaja algo hice mal miren lo que me da:

date=05/04/2015
FechaM=03/15/2015
Diferencia=206


Page 1 of 1


  
You cannot post new topics
You cannot reply to topics
You cannot edit your posts
You cannot delete your posts
You cannot vote in polls
You cannot attach files
You can download files
You cannot post calendar events

   

This is a "Lo-Fi" version of our main content. To view the full version with more information, formatting and images, please click here.

Powered by Icy Phoenix based on phpBB
Design by DiDiDaDo

Generation Time: 0.1398s (PHP: -22% SQL: 122%)
SQL queries: 23 - Debug Off - GZIP Enabled